-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample2.almas
48 lines (44 loc) · 840 Bytes
/
sample2.almas
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
@print("Welcome to ALMAS!")
loop(i:1:10:0){
@print("In Loop with index: ")
@print(i)
# x = @input("Enter Order ID: (0 is for help)")
if(x is 0){
@print("Menu Options: ")
@print("0 -> Help")
@print("1 -> simple adder")
@print("2 -> meh...")
@print("3 -> fibo!")
@print("10 -> exit")
go
} elif(x is 10){ break }
elif(x is 2){@print("....meh")}
elif(x is 1){
# z = @input("z?")
# y = @input("y?")
# sum = add(z, y)
@print(sum)
}elif(x is 3){
# n = @input("Which n for fibo?")
# f = fibo(n)
@print(f)
}
else{
@print("invalid choice")
}
}
$ myString = "defined in ALMAS"
@java("int xx = 2; System.out.println(myString);")
fn # add(# a , # b){
# sum = a + b
ret sum
}
fn # fibo(#n){
# a = 0
# b = 1
if(n <= 1.001){
@java("return 1;")
}
@java("return fibo(n - 1) + fibo(n - 2);")
}
@print("Have a nice day!")