Debian Codegraph @

examples/prism-monkey.html

raw symbols SCIP
1 <h2>Comments</h2>
2 <pre><code>' This is a comment
3
4 #Rem ' This is the start of a comment block
5 Some comment ' We are inside the comment block
6 #End</code></pre>
7
8 <h2>Strings</h2>
9 <pre><code>"Hello World"
10 "~qHello World~q"
11 "~tIndented~n"</code></pre>
12
13 <h2>Numbers</h2>
14 <pre><code>0
15 1234
16 $3D0DEAD
17 $CAFEBABE
18
19 .0
20 0.0
21 .5
22 0.5
23 1.0
24 1.5
25 1.00001
26 3.14159265</code></pre>
27
28 <h2>Variable types</h2>
29 <pre><code>Local myVariable:Bool = True
30 Local myVariable? = True
31 Local myVariable:Int = 1024
32 Local myVariable% = 1024
33 Local myVariable:Float = 3.141516
34 Local myVariable# = 3.141516
35 Local myVariable:String = "Hello world"
36 Local myVariable$ = "Hello world"</code></pre>
37
38 <h2>Full example</h2>
39 <pre><code>Import mojo
40
41 Class MyApp Extends App
42
43 Method OnCreate()
44
45 SetUpdateRate 60
46
47 End
48
49 Method OnRender()
50
51 Local date:=GetDate()
52
53 Local months:=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
54
55 Local day:=("0"+date[2])[-2..]
56 Local month:=months[date[1]-1]
57 Local year:=date[0]
58 Local hour:=("0"+date[3])[-2..]
59 Local min:=("0"+date[4])[-2..]
60 Local sec:=("0"+date[5])[-2..] + "." + ("00"+date[6])[-3..]
61
62 Local now:=hour+":"+min+":"+sec+" "+day+" "+month+" "+year
63
64 Cls
65 DrawText now,DeviceWidth/2,DeviceHeight/2,.5,.5
66 End
67
68 End
69
70 Function Main()
71
72 New MyApp
73
74 End</code></pre>