Cazax
05-14-2008, 11:11 PM
Here we go:
Booleans:
They can be True or False(you might know them).
How do i declare them(remember begginer tuts)?:
Var
BoolTest : Boolean;
How do i use them?
Program New;
Var
BoolTest : Boolean;
Begin
BoolTest := True;
Writeln('BoolTest is '+BoolToStr(BoolTest)+'!');
BoolTest := False;
Writeln('BoolTest is '+BoolToStr(BoolTest)+'!');
End.
You might remember them from begginer tuts, but here i'll explain them deeper...:
Or:
If (Something) Or (This) Then
How would i know if it returns True?:
True Or True = True;
True Or False = True;
False Or True = True;
False Or False = False;
Or check if one or all of them are True.
Xor:
Some people doesn't know how does it work:
If (Something) Xor (This) Then
True Xor True = False;
True Xor False = True;
False Xor True = True;
False Xor False = False;
Xor check if one of the sides is True.
Not:
If (Not (LoggedIn)) Then
Not True = False;
Not False = True;
Not check if the following boolean isn't True.
>,<,=:
They compare two statements:
If (1 > 0) Then
If (1 = 1) Then
If (1 < 2) Then
> : Returns True if the first statement is higher than the second.
<: Returns True if the first statement is lower than the second
=: Returns True if both statements are equal.
Examples:
If ('hi' = 'hi') Then
If (1.1 > 1.5) Then
There is a shortener way to do this:
If (X < Y) Or (X = Y) Then
Just use:
If (X <= Y) Then
And:
And check if both booleans are True.
If (True) And (True) Then
True And True = True;
True And False = False;
False And True = False;
False And False = False;
Booleans:
They can be True or False(you might know them).
How do i declare them(remember begginer tuts)?:
Var
BoolTest : Boolean;
How do i use them?
Program New;
Var
BoolTest : Boolean;
Begin
BoolTest := True;
Writeln('BoolTest is '+BoolToStr(BoolTest)+'!');
BoolTest := False;
Writeln('BoolTest is '+BoolToStr(BoolTest)+'!');
End.
You might remember them from begginer tuts, but here i'll explain them deeper...:
Or:
If (Something) Or (This) Then
How would i know if it returns True?:
True Or True = True;
True Or False = True;
False Or True = True;
False Or False = False;
Or check if one or all of them are True.
Xor:
Some people doesn't know how does it work:
If (Something) Xor (This) Then
True Xor True = False;
True Xor False = True;
False Xor True = True;
False Xor False = False;
Xor check if one of the sides is True.
Not:
If (Not (LoggedIn)) Then
Not True = False;
Not False = True;
Not check if the following boolean isn't True.
>,<,=:
They compare two statements:
If (1 > 0) Then
If (1 = 1) Then
If (1 < 2) Then
> : Returns True if the first statement is higher than the second.
<: Returns True if the first statement is lower than the second
=: Returns True if both statements are equal.
Examples:
If ('hi' = 'hi') Then
If (1.1 > 1.5) Then
There is a shortener way to do this:
If (X < Y) Or (X = Y) Then
Just use:
If (X <= Y) Then
And:
And check if both booleans are True.
If (True) And (True) Then
True And True = True;
True And False = False;
False And True = False;
False And False = False;