mirror of
https://github.com/vishapoberon/oberonbyexample.git
synced 2026-04-05 21:02:25 +00:00
post rebranding
This commit is contained in:
parent
4169aecd5b
commit
95b512baf4
66 changed files with 716 additions and 15 deletions
24
examples/procedures/var-parameter/VarParam.Mod.ob2
Normal file
24
examples/procedures/var-parameter/VarParam.Mod.ob2
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
MODULE varparam;
|
||||
|
||||
|
||||
IMPORT Out;
|
||||
|
||||
|
||||
VAR a, b : INTEGER;
|
||||
|
||||
|
||||
PROCEDURE swapVals(VAR x, y : INTEGER);
|
||||
VAR tmp : INTEGER;
|
||||
BEGIN
|
||||
tmp := x; x := y; y := tmp;
|
||||
END swapVals;
|
||||
|
||||
|
||||
BEGIN
|
||||
a := 6; b := 9;
|
||||
Out.String("initial "); Out.Ln;
|
||||
Out.String("a : "); Out.Int(a, 0); Out.String("; b : "); Out.Int(b, 0); Out.Ln;
|
||||
swapVals(a, b);
|
||||
Out.String("after swap"); Out.Ln;
|
||||
Out.String("a : "); Out.Int(a, 0); Out.String("; b : "); Out.Int(b, 0); Out.Ln;
|
||||
END varparam.
|
||||
Loading…
Add table
Add a link
Reference in a new issue