1
0
lazarus-tutorials/simple_examples/simple_expressions.pas

23 lines
680 B
ObjectPascal
Raw Normal View History

program simple_expressions;
{$mode objfpc}{$H+}
var
b: Byte = 4;
c: Byte = 3;
begin
WriteLn('Initial value of b is ', b, '; initial value of c is ', c, sLineBreak);
b := b shr 1; // >> shift right
2021-09-30 13:49:53 -04:00
c := c shl 4; // << shift left
WriteLn('After b shr 1, b is ', b, '; after c shl 4, c is ', c, sLineBreak);
2021-09-30 13:49:53 -04:00
WriteLn('c xor b = ',c xor b, '; c and b = ', c and b, '; c or b = ', c or b);
WriteLn('not c is ', not c, '; not b is ', not b);
WriteLn;
WriteLn('c > b is ', c > b, '; c < b is ', c < b, '; c <> b is ', c <> b, '; c = b is ', c = b);
WriteLn;
WriteLn('c div b is ', c div b, '; c mod b is ', c mod b);
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.