about summary refs log tree commit diff
path: root/examples/5.pry
blob: f12fbae4a077c2e1b8d7df867718d31b35d452d6 (plain) (blame)
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
/* As you see, the language supports variable scopes */

import "!stdlib.pry";

let x = 18;

let foo = () => i64 {
	let x = 1;
	printf("%d\n", x);
	return x;
};

let main = () => i64 {
	printf("%d\n", x);
	let x = 2;
	let y = foo();
	printf("%d\n", x);
	return x + y;
};

/*

Expected stdout:

18
1
2

Expected return: 3

*/