DelphiBasics
Odd
Function
Tests whether an integer has an odd value System unit
 function Odd(Number Integer | Int64):Boolean;
Description
The Odd function returns true if the given Number is odd (remainder of 1 when divided by 2).
Related commands
BooleanAllows just True and False values
 Download this web site as a Windows program.




 
Example code : Show all odd numbers in the range 1 to 9
var
  i : Integer;

begin
  // Display all odd numbers in the range 1 to 9
  for i := 1 to 9 do
    if Odd(i) then ShowMessageFmt('%d is odd',[i]);
end;
Show full unit code
  1 is odd
  3 is odd
  5 is odd
  7 is odd
  9 is odd
  
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page