Dear Sir,

The following is a simple program in Delphi. Could you tell me the meaning of the colour in red.

program Negatives;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  ourcrt;

var
        balance, posNeg:integer;

begin
  randomize;
  writeln ('Generating your bank balance');
  writeln ('Please wait .....');
  sleep (2000);
  create a random number between 0 and 1000
  balance:=random(1000);
 randomly decide if the balance is negative
  1 for positive, 0 for negative
  posNeg:=random(2);
  if posNeg=0 then
    begin
       balance:=balance *-1;
       writeln('Can you hear that sound? Its your cheque bouncing');
       sound(200,1000);
       end
       else
         begin
           writeln ('Positive balance');
         end;
       writeln('Your balance is ', balance);
       sleep(5000);
end.

Cheers,

Edited 3 Years Ago by pritaeas: Fixed formatting

balance:=balance*-1;

:confused:
balance:=balance*(-1)
we want to multiply the value of balance
by negative number. :D

This question has already been answered. Start a new discussion instead.