Jump to content

Help me understand a script condition


AlexxEG

Recommended Posts

That's exactly right, but here's a little more detail:

 

The "is not equal to" operator, denoted by "!=", returns a value of 0 if its two parameters are equal, and returns 1 if they are not equal. In this case, if "GameDay" is not equal to "RentDay" then the expression will evaluate to 1 so the condition will be true. However, if they are equal then the expression will evaluate to 0 so the condition will be false.

 

Knowing exactly how logical operators like this one are evaluated can help you to use them in more complicated scenarios. For example, the following code will set the value of "index" to 0 if it is equal to 8, and will set it to 8 otherwise, without the use of a conditional statement:

set index to (index != 8) * 8

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...