Results 1 to 7 of 7

Thread: Differnce between = and :=

  1. #1
    Join Date
    Nov 2011
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Differnce between = and :=

    I see assignment use = and some times :=

    What is the difference between the two.

    Simba Code:
    program new;

    var
    NumHerbToClean:Integer;

    begin

    NumHerbToClean := 28;

    if NumHerbToClean == 28 then
    begin
      Writeln('I want stone');
    end;


    end.

    I made a simple script. But is not working. The error is on line

    Simba Code:
    if NumHerbToClean == 28 then

    How do i check value of variable ?

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    We use = as an equel sign.

    Simba Code:
    if a = b then
      writeln('a equals b');

    we use := to set a variable.

    Simba Code:
    a := 2;
    b := a;
    Working on: Tithe Farmer

  3. #3
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    This may be wrong but := stands for an integer, = means If it is "ThisSTring" then blahblah...
    This:
    Simba Code:
    if NumHerbToClean == 28 then
    Should be This:
    Simba Code:
    if NumHerbToClean = 28 then
    E: Ninja'd
    E#2: Oh and this should be Here

  4. #4
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by John View Post
    This may be wrong but := stands for an integer, = means If it is "ThisSTring" then blahblah...
    This:
    Simba Code:
    if NumHerbToClean == 28 then
    Should be This:
    Simba Code:
    if NumHerbToClean = 28 then
    E: Ninja'd
    A plain = can be used for an integer as well, as long as it has already been set with a := earlier in the script.
    - My Scripts (Beginning to Update to SRL 6) -

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Also = is used to set constants.

    So
    Simba Code:
    const
      ThisConstant = 28;
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  6. #6
    Join Date
    Nov 2011
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Thanks everyone for the help.

    @John first i was thinking to ask on SRL Help. But this is general programing help, so posted here.

    I googled, found

    http://www.functionx.com/objectpascal/Lesson16.htm

    At the end of the page, it lists operators.

    == Equality to
    Simba don't use exact pascal operators ?

  7. #7
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by RuneDragon View Post
    Thanks everyone for the help.

    @John first i was thinking to ask on SRL Help. But this is general programing help, so posted here.

    I googled, found

    http://www.functionx.com/objectpascal/Lesson16.htm

    At the end of the page, it lists operators.



    Simba don't use exact pascal operators ?
    That last table is wrong. In the rest of that article they are talking about =. Also the language you are writing in simba is pascalscript not pascal, but yeah, we do use the pascal operators.
    Working on: Tithe Farmer

Thread Information

Users Browsing this Thread

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

Posting Permissions

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