A boolean is one of two things: true or false. You can create a variable for like like this:
Turing: |
var tehEpicBool : boolean := true
|
Anything you evaluate that is either true or false, right or wrong, is a boolean. Eg.
Turing: |
put (5 > 3)
% this will print 'false'
put (9 >= 9)
% this will print 'true'
put (6 not= 4)
% this will print 'true'
|
umm no offence but for the first 1 its true cause 5 is bigger than 3, i think u ment to write 3 > 5 not 5> 3
Booleans are used to test conditions mostly.
eg.
Turing: |
var i := 1
loop
put i
i := i + i
exit when i > 99
%when the value of i is greater than 99, this will be true and the 'exit' command will leave the loop
end
|