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.

AppGameKit Classic Chat / Problem with 'While NOT' loop

Author
Message
Doz
16
Years of Service
User Offline
Joined: 16th Apr 2008
Location:
Posted: 25th Oct 2011 05:09
So title says it, I'm having trouble getting a while loop to recognize the NOT command. I have it print out the variable so I see it get to what should be a true statement and break the loop but it just keeps going.



That is what I'm trying to use (and I tried a couple variations), I suppose I'm not using it correctly but I can't find much in the help for making a negative comparison. Any help would be much appreciated.

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 25th Oct 2011 05:24
Not equals <> seems more appropriate here




You might need to bracket right side of the comparison, depends on AppGameKit deals with order of operations..



Doz
16
Years of Service
User Offline
Joined: 16th Apr 2008
Location:
Posted: 25th Oct 2011 06:32
Ah, that is what I've been looking for, probably missed it because I was looking for something more like != Thanks

MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 25th Oct 2011 13:49
Normally you will use NOT in the context of an expression being TRUE.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Oct 2011 15:16
You don't need to bracket equations in AppGameKit basic:

...will get the same results as:

...and:


You can also add boolean operations in:

...but I prefer to bracket around parts of boolean operations to make them easier to distinguish:


Davee
13
Years of Service
User Offline
Joined: 6th Sep 2011
Location: North West of England
Posted: 26th Oct 2011 22:28
Quote: "
while (temp <> CurrentLevel * 1000) and (temp <> CurrentLevel * 2000) // etc
endwhile"

I also prefer and strongly advise this method. I would not put brackets around everything just for the sake of it but enough to make the code instantly readable like this is a great benefit when someone new comes to the code, or ourselves after a break.

Of all the things I've lost, it's my... my... oh darn it.

Login to post a reply

Server time is: 2024-11-22 10:48:16
Your offset time is: 2024-11-22 10:48:16