Jump to content
Sign in to follow this  
apsync

or

Recommended Posts

apsync

how do i 'or' for example ->

If $A = 5 Or $B = 7 Then
 ;...
EndIf

is that valid?

Share this post


Link to post
Share on other sites
jpm

how do i 'or' for example ->

If $A = 5 Or $B = 7 Then
;...
EndIf

is that valid?

<{POST_SNAPBACK}>

When you read the language reference doc under operator you found out the operator precedence definition and you found out the = will take place before OR so your code is equivalent to

If ($A = 5) Or ($B = 7) Then
;...
EndIf

I hope it is what you want

PLease look at the doc and report what can be missing or wrong :(

Share this post


Link to post
Share on other sites
Henrik

Anyway you should always use parentheses in compound boolean expressions.

- saves having to remember operator precedence (especially useful if you work in more than one programming language).

- makes your code easier to maintain & less ambiguous for others to read.

If ($A = 5) Or ($B = 7) Then
If $A = (5 Or ($B = 7)) Then

Ignorance is strength.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.