-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.coda
71 lines (56 loc) · 1.25 KB
/
demo.coda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import Maths
// Comment
// Comments can be closed by a semi colon;
let int x = 30; // this would run;
// this would also run; let float y = 40.0;
// this is how you define functions
def function_name (param1,param2){
// code goes here
return 0;
}
// we have SCOPES!!
scope scopename {
let string x = "Hello World";
const int PI = Maths.PI; // consts cannot be changed
def fuc(param){
return 3;
}
}
for(let int i = 0; i< 300; i++){
if(i %2 ==0){
break;
}
elif(i %3 ==1){
continue;
}
else {
return;
}
}
// here is while loop;
let x = 0;
while(x++ != 10){
continue;
}
do{
//this
}while(x-- > 0);
// to use SCOPES
// we use the dot operator
println(scopename.x); // and yes semicolon is optional
// We have objects!!
let obj = {
x: 30,
y: 50,
func: def(param1,para2){
// yes there are funcs in objects as well...
}
}
// lists in our language
const list abc = [1,2,4,5];
//Types
// (int|bool|byte|float|list|object|double|string|long)
// Keywords
//(let|const|def|if|elif|else|for|while|break|return|scope|continue|typeof|sizeof|do|in|native)
// BuiltIn Functions
// (print|println|sleep|input|parseInt|parseFloat|parseDouble|parseByte|parseBool|quit|exit)