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

my foo = 1;

{
	# Prints out 1
	assert 1 == (put defined foo);

	{
		my bar = 2;

		# Prints out 1
		assert 1 == (put defined bar);

		# Prints out all available symbols at
		# the current program position.
		scope;
	}

	# Prints out 0
	assert 0 == (put defined bar);

	my baz = 3;
}

# Prints out 0
assert 0 == (say defined bar);