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

Assignments within condition of while / if #33

Open
VeloxAmbitum opened this issue Apr 14, 2014 · 1 comment
Open

Assignments within condition of while / if #33

VeloxAmbitum opened this issue Apr 14, 2014 · 1 comment

Comments

@VeloxAmbitum
Copy link
Contributor

Assignments within a while or if condition result in the compiler error "Malformed loop or if statement."

For example:

  function func()
  {
    return false;
  }

  function exported main()
  {
    var variable;
    while((variable = func())){}
  }
@gundermanc
Copy link
Owner

Yeah. That's semi intentional. I like being able to assign them that way too, but the way its currently implemented, that isn't allowed. I can change it if you want.

Or you can do this:

var variable;
do {
  variable = func();
} while(variable);

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

No branches or pull requests

2 participants