Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / C++: "if ( a == 1 || b == 2) { ... } // How To Do In AGK's BASIC??"

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 3rd May 2017 01:33
Hi.

In C++ we can use the following code:
_______________________________________________________
if ( a == 1 || b == 2 )
{
//Do something!
}
_______________________________________________________

How can we do the above in AppGameKit's BASIC language?
("||" is OR operator in C++)

Thanks!
JeZxLee
16BitSoft Inc.
Video Game Design Studio
http://www.16BitSoft.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd May 2017 02:02 Edited at: 3rd May 2017 02:06
Like this


One very important thing to remember is that it will evaluate ALL the conditions in the statement even if the first condition is true/false.
So a condition where max is the maximum number of elements in the array like
if idx < max and arr(idx) not = 1
will crash when idx >= max because it will evaluate ALL the conditions

Login to post a reply

Server time is: 2024-11-22 02:14:21
Your offset time is: 2024-11-22 02:14:21