summaryrefslogtreecommitdiff
path: root/examples/control.fy
blob: 0deac7896de7ec99c02abd624cc1e21efff00835 (plain)
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
#*
 * Examples of how to use control statements
 *#

if 1 { 
	say "if 1";
} 

ifnot 0 == 1 { 
	say "ifnot 0 == 1";
} 

# Calculate 10!

my n = 10, fac = 0;

while n > 1 {
	ifnot fac {
		fac = 1;
	}
	say fac = (fac * n);
	decr n;
}

# Count up to 10

n = 0;

until n == 10 {
	say incr n;
}