Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect implementation of case statements #258

Open
Jens-G opened this issue Mar 3, 2022 · 0 comments
Open

incorrect implementation of case statements #258

Jens-G opened this issue Mar 3, 2022 · 0 comments

Comments

@Jens-G
Copy link

Jens-G commented Mar 3, 2022

var nr : Integer;
begin
  case nr of
    1 :  {statement};
    2 :  {statement};
  else
    {statement};
    {statement};
    ...
    {statement};
  end;
end;

PascalScript impl seems to assume that the else branch is also a single statement, which is wrong. The else branch of a switch actually forms already a code block: It can hold an arbitrary number of statements without the need of an extra begin/end pair.

It may look inconsistent but it actually is that way back to TurboPascal and earlier.

https://www.gnu-pascal.de/gpc/case.html

Found in InnoScript, if that is of any relevance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant