Results 1 to 7 of 7

Thread: is ('=') expected at line 6 Compiling failed.

  1. #1
    Join Date
    Mar 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Question is ('=') expected at line 6 Compiling failed.

    Hey everyone,

    I'm a new member learning my place here on the SRL forums. I've never been one to go around crying and posting tons of threads because I'm stuck. Always tried my best to figure it out even if it took me hours. I really don't want things handed to me on a silver platter, I do really enjoy learning Pascal and everything to do with SRL.

    Now this one has got me stumped...
    [Error] C:\Simba\Scripts\RandFletcherv1.1.2.simba(7:10): is ('=') expected at line 6
    Compiling failed.
    Here's line 6:
    const x, y, bankcolour,inventoryCounter, LogCounter: Integer;
    ANY help even the slightest tip is GREATLY appreciated. Thanks for taking the time out of your day to look at my thread.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    The keyword, const, refers to constant, by which declares something that remains constant throughout the script.

    You can only declare a single constant at a time, meaning:
    Simba Code:
    const
      // wrong b/c you can only declare one constant at a time to equal 1.
      a, b, c = 1;

      // wrong b/c this doesn't define anything, and a constant has to be defined so it may remain constant
      d: Integer; //wrong

      // correct - we define e to be constant with a value of 2.7
      e = 2.7;

    the var keyword, referring to Variables, are types that can be define like:
    Simba Code:
    var
      i, x, y : Integer;
      e: Extended;
      arr: TIntegerArray;
    .. and be manipulated within their type constraints during the script/at a later time. Variables do not remain constant like the const keyword.
    Last edited by Le Jingle; 03-14-2013 at 06:20 AM. Reason: typo

  3. #3
    Join Date
    Mar 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    The keyword, const, refers to constant, by which delclares something that remains constant throughout the script.

    You can only declare a single constant at a time, meaning:
    Simba Code:
    const
      // wrong b/c you can only declare one constant at a time to equal 1.
      a, b, c = 1;

      // wrong b/c this doesn't define anything, and a constant has to be defined so it may remain constant
      d: Integer; //wrong

      // correct - we define e to be constant with a value of 2.7
      e = 2.7;

    the var keyword, referring to Variables, are types that can be define like:
    Simba Code:
    var
      i, x, y : Integer;
      e: Extended;
      arr: TIntegerArray;
    .. and be manipulated within their type constraints during the script/at a later time. Variables do not remain constant like the const keyword.
    Thanks for the fast reply man.

    So it needs to be a variable. Whenever I do change it from const to var, it gives me an error:
    [Error] C:\Simba\Scripts\RandFletcherv1.1.2.simba(13:13): colon (':') expected at line 12
    Compiling failed.
    heres line 12:
    TComboBox4. TComboBox5: TComboBox;
    Whenever I add the colon it just completely ruins the entire thing. Am I missing something after my variable or that line of code?

  4. #4
    Join Date
    Nov 2012
    Posts
    141
    Mentioned
    0 Post(s)
    Quoted
    43 Post(s)

    Default

    I told you how to fix this in your last thread?

  5. #5
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by Simbarules View Post
    Thanks for the fast reply man.

    So it needs to be a variable. Whenever I do this it gives me an error:


    heres line 12:


    Whenever I add the colon it just completely ruins the entire thing.
    When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
    Thus, if I were to declare several integers, I might do something like;
    Simba Code:
    var
      number1, number2: Integer;

    or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;
    Simba Code:
    var
      b, box2, coolBox: TBox;

    Notice the commas that separate each declared variable of the same type.

  6. #6
    Join Date
    Mar 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
    Thus, if I were to declare several integers, I might do something like;
    Simba Code:
    var
      number1, number2: Integer;

    or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;
    Simba Code:
    var
      b, box2, coolBox: TBox;

    Notice the commas that separate each declared variable of the same type.
    I honestly cannot thank you enough. You've taught me a lot.

    Thanks for helping out man.

  7. #7
    Join Date
    Mar 2013
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    127 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
    Thus, if I were to declare several integers, I might do something like;
    Simba Code:
    var
      number1, number2: Integer;

    or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;
    Simba Code:
    var
      b, box2, coolBox: TBox;

    Notice the commas that separate each declared variable of the same type.
    You shouldn't hand out answers to anti leeches.

    Teaching is one thing but straight telling is another..

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
  •