SRL Archive - RS3 Help

[Lape] "or" in case statements


KeepBotting

2015-03-26 20:52:09

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:


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?

Olly

2015-03-26 20:56:01

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

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

Is what you want.

iEatApplez

2015-03-26 20:57:53

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

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

Is what you want.


I am to blame. Sorry :p

KeepBotting

2015-03-26 20:58:02

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

'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!