Results 1 to 4 of 4

Thread: [Lape] "or" in case statements

  1. #1
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default [Lape] "or" in case statements

    Placing an or statement in one of the cases inside a case statement doesn't seem to work. It throws access violations.

    Example, run this code:

    Simba Code:
    program new;
    {$define smart}
    {$i srl-6/srl.simba}

    const
    someString = 'hello';

    procedure thingy();
    begin
      case (someString) of
        'hello': writeln('how are you?');

        'goodbye': writeln('see you later!');

        'this' or 'that': writeln('access violation?');
      end;
    end;

    begin
    thingy();
    end.

    It will throw an access violation. Comment out line 15 and it will no longer throw an access violation.

    Why is this? Is or not allowed in cases?
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Where did you ever hear that or will work. :s

    Simba Code:
    'Foo', 'Foo2': Writeln('Hello');

    Is what you want.

  3. #3
    Join Date
    Sep 2014
    Location
    the Netherlands
    Posts
    136
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Where did you ever hear that or will work. :s

    Simba Code:
    'Foo', 'Foo2': Writeln('Hello');

    Is what you want.
    I am to blame. Sorry
    Previously known as; Annonymus.

  4. #4
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Where did you ever hear that or will work. :s

    Simba Code:
    'Foo', 'Foo2': Writeln('Hello');

    Is what you want.
    Didn't hear it anywhere, honestly had no idea it was supposed to be done that way.

    Was just my natural instinct to use or to compare items in a case. Thanks for correcting me!
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

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
  •