Created
December 13, 2018 09:23
-
-
Save affandhia/c5bb1823ad7edcdc7fc3fb8a1f9c427e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ var x : integer | |
proc a | |
{ ; | |
x := 14 | |
put "in proc a - x ",x | |
} ; | |
put "before calling - proc standard " | |
a | |
put "after calling x ",x | |
if x=14 then | |
put "--ok--" | |
end if | |
} | |
########################################### | |
{ var x : integer | |
proc b | |
{ ; | |
x := x + 28 | |
put "b" | |
} | |
proc a | |
{ var c : integer; | |
x := x + 14 | |
put "a" | |
} | |
; | |
x := 14 | |
put "before proc + proc/func - x ",x | |
a | |
put "after calling a - x ",x | |
b | |
put "after calling b - x ",x | |
if x=56 then | |
put "--ok--" | |
end if | |
} | |
########################################### | |
{ var x : integer | |
integer func fa = x * 2 | |
; | |
x := 7 | |
put " before calling func standard x ",x | |
put " after calling fa ", fa | |
if fa=14 then | |
put "--ok--" | |
end if | |
} | |
########################################### | |
{ var x : integer | |
integer func fa = { | |
var a : integer | |
var b : integer; | |
a := 7 | |
b := 2 | |
put "a ",a," b ",b; | |
a * b | |
} | |
; | |
put "func non standard a*b ", fa | |
if fa=14 then | |
put "--ok--" | |
end if | |
} | |
########################################### | |
{ var x : integer | |
proc a | |
{ var c : integer | |
proc a1 | |
{ var c : integer; | |
c := 0 | |
put "C in a1 ",c | |
x := c+3 | |
put "x in a1 ",x | |
} | |
; | |
a1 | |
put "x in a ",x | |
} | |
var y : integer; | |
y := 2 | |
put "proc nested " | |
put "y in main ",y | |
a | |
put " x after calling a ",x | |
put " x + y -- ",x+y | |
if x+y=5 then | |
put "--ok--" | |
end if | |
} | |
########################################### | |
{ var x : integer | |
integer func a = | |
{ var c : integer; | |
c :=2 | |
x := x+c | |
put "c in a ",c | |
put "x in a ",x | |
if x < 6 then | |
c:=2*x+a | |
put "c in a after condition ",c | |
end if | |
; | |
c | |
} | |
var y : integer; | |
put "func recursive " | |
x := 2 | |
put " --- x before calling a ",x | |
x :=x+a | |
put " --- x after calling a ",x | |
if x=12 then | |
put "--ok--" | |
end if | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment