# Test of integer operations # # $Id: test1.mgl,v 1.2 2001/08/27 08:40:16 gkminix Exp $ const c1 = 20; c2 = 30; screen main; var i1, i2, i3 : integer; begin # Integer assignments i1 := 1; i2 := 2; i3 := 3; # Simple numerical operations i3 := i1 + i2; i1 := i2 - i3; i1 := i1 * 5; i2 := i1 div 4; i2 := i1 / 4; i2 := i1 mod 4; i2 := i1 % 4; i2 := -i2; # Simple logical operations i2 := i1 and $1234; i2 := i2 or i1; i2 := not i2; i2 := i3 xor i1; # Complex expressions i2 := (i1 + i3) * 4; i2 := i1 + i3 * 4; # not the same as above i2 := (i1 + i3) div i1; i2 := i1 + i3 div i1; i2 := (i1 + i3) * (20 - i2); # Numerical functions i2 := sqr(i1); i2 := abs(i1 - 30); i2 := ord(i2); # Complex constant expressions i2 := c1 + c2; i2 := (c1 + c2) * 5 - c2; i2 := (i2 + (c1 + c2) mod c1) and $1234; end.