Results 1 to 4 of 4

Thread: Booleans[Or,Xor,Not,>,<,=]

  1. #1
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Booleans[Or,Xor,Not,>,<,=]

    Here we go:
    Booleans:
    They can be True or False(you might know them).
    How do i declare them(remember begginer tuts)?:
    SCAR Code:
    Var
      BoolTest : Boolean;
    How do i use them?
    SCAR Code:
    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:
    SCAR Code:
    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:
    SCAR Code:
    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:
    SCAR Code:
    If (Not (LoggedIn)) Then
    Not True = False;
    Not False = True;

    Not check if the following boolean isn't True.

    >,<,=:
    They compare two statements:
    SCAR Code:
    If (1 > 0) Then
    SCAR Code:
    If (1 = 1) Then
    SCAR Code:
    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:
    SCAR Code:
    If ('hi' = 'hi') Then
    SCAR Code:
    If (1.1 > 1.5) Then

    There is a shortener way to do this:
    SCAR Code:
    If (X < Y) Or (X = Y) Then
    Just use:
    SCAR Code:
    If (X <= Y) Then

    And:
    And check if both booleans are True.
    SCAR Code:
    If (True) And (True) Then
    True And True = True;
    True And False = False;
    False And True = False;
    False And False = False;


  2. #2
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice, could you explain xor better please, i still dont understand.

    also what is:

    SCAR Code:
    if x <> y then

    ?

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    You missed and
    Also, it'd be cool if you could turn this into a bitwise tutorial too.

    @Skilld u, that's not equal to.

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by skilld u View Post
    nice, could you explain xor better please, i still dont understand.

    also what is:

    SCAR Code:
    if x <> y then
    ?
    Ill add the <> in the tut.
    Quote Originally Posted by bullzeye95 View Post
    You missed and
    Also, it'd be cool if you could turn this into a bitwise tutorial too.

    @Skilld u, that's not equal to.
    Oops i missed and Hmm Yawman made a bitwise tut.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Booleans
    By djpyro2010 in forum OSR Help
    Replies: 2
    Last Post: 10-25-2007, 05:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •