Back to manual index

Math operation characters:

  • Math symbol '+' Addition
     NewValue := 5 + 1;
     writeln(NewValue);
    
    Returns 6
  • Math symbol '-' Subtraction
     NewValue := 7 - 5;
     writeln(NewValue);
    
    Returns 2
  • Math symbol '*' Multiplication
     NewValue := 7 * 5;
     writeln(NewValue);
    
    Returns 35
  • Math symbol '/' Division
     NewValue := 21 / 3;
     writeln(NewValue);
    
    Returns 7
  • Math symbol '^' power
     NewValue := 4 ^ 3;
     writeln(NewValue); 
    
    Returns 64
  • Math symbol '#' square route
     NewValue := 16 #;
     writeln(NewValue);
    
    Returns 4
  • Math symbol '~' round the number to integer
     intValue := 444.2 ~;
    
    writeln(NewValue); Returns 444
     
     intValue := 134.7 ~;
    
    writeln(NewValue); Returns 135
  • Math symbol '%' modulus
     NewValue := 4 % 2;
     writeln(NewValue); 
    
    Returns 0
     NewValue := 10 % 3;
     writeln(NewValue); 
    
    Returns 1 :: Please note: when doing mathematical operations with variables, GibPascal does left to right operations. :: Example:
    program mathtest;
    
    var testInt : integer;
    
    begin
      testInt := 7 + 10 * 4;
      writeln(testInt);
    
    returns 68
     testInt := 10 * 4 + 7;
     writeln(testInt);
    
    returns 47