Skip to main content
Participant
August 17, 2006
Answered

'if' statement with multiple conditions?

  • August 17, 2006
  • 2 replies
  • 3110 views
Here's what I'm trying to do:

if ((condition1 == true) and (condition2 == true)) {
//run this code
}

It compiled/ran fine under AS2, but it doesn't look like AS3 likes them. I get the following errors:
"Syntax error: expecting rightparen before and"
"Syntax error: rightparen is unexpected"
"Syntax error: expecting semicolon before leftbrace"

What gives? Will this be fixed before the final release?
This topic has been closed for replies.
Correct answer Craig Grummitt
i don't know how it's handled in AS3, but i do know 'and' is deprecated since Flash 5 in favour of &&. see livedocs

2 replies

Participant
August 17, 2006
I did not know this, thanks for the info. Replacing 'and' with '&&' fixed the problem in AS3.
Craig Grummitt
Craig GrummittCorrect answer
Inspiring
August 17, 2006
i don't know how it's handled in AS3, but i do know 'and' is deprecated since Flash 5 in favour of &&. see livedocs