summaryrefslogtreecommitdiff
path: root/examples/functions.fy
blob: c5e51e2400fe5c94abfa5ad9fd4cb060660134c6 (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
#*
 * Examples of how to use functions
 *#

fun foo {
	say 1 + a * 3 + b;

	fun bar {
		say "Hello i am nested";
	}

	bar; # Calling nested
}

my a = 2, b = 4; # Create global variables
foo;
assert 0 == (defined bar); # bar is not available anymore

fun baz {
	say "I am baz";
	undef baz; 
}

baz; # Baz deletes itself
assert 0 == (defined baz); # baz is not available anymore