AlexxEG Posted December 10, 2009 Share Posted December 10, 2009 What does this line mean?if ( GameDay != RentDay ) Link to comment Share on other sites More sharing options...
BadPenney Posted December 10, 2009 Share Posted December 10, 2009 If GameDay does not equal RentDay Link to comment Share on other sites More sharing options...
Cipscis Posted December 10, 2009 Share Posted December 10, 2009 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) * 8Cipscis Link to comment Share on other sites More sharing options...
AlexxEG Posted December 11, 2009 Author Share Posted December 11, 2009 Ahhh... Okey. That help alot^^ Thanks Link to comment Share on other sites More sharing options...
Recommended Posts