Hi,
is equivalent toCode:IF MEM_1 = 2 THEN SPEED = 1 : GOSUB SOMETHING
orCode:IF MEM_1 = 2 THEN SPEED = 1 GOSUB SOMETHING
Code:IF MEM_1 = 2 THEN SPEED = 1 ENDIF GOSUB SOMETHING
Hi,
is equivalent toCode:IF MEM_1 = 2 THEN SPEED = 1 : GOSUB SOMETHING
orCode:IF MEM_1 = 2 THEN SPEED = 1 GOSUB SOMETHING
Code:IF MEM_1 = 2 THEN SPEED = 1 ENDIF GOSUB SOMETHING
Regards
Sougata
This is weird. The email message when sougata posted said
################################
Hi,
A colon separated mulitple statement will always compile so
Code:
---------
IF MEM_1 = 2 THEN SPEED = 1 : GOSUB SOMETHING
---------
is equivalent to
Code:
---------
IF MEM_1 = 2 THEN SPEED = 1
GOSUB SOMETHING
---------
or
Code:
---------
IF MEM_1 = 2 THEN
SPEED = 1
ENDIF
GOSUB SOMETHING
---------
So if you really want to execute multiple command based on a conditions then *ENDIF*
is the way.
##########################
But the forum does not have the whole message. I am on a windows machine today so maybe...
Dave
Always wear safety glasses while programming.
Hi,
I wrote the original thread counting on my past experience but then again I didn't try out flotul's structure. May be I will trying peeping the compiled hex and find out if it does carry out a conditional check on ":"So did not want to confuse readers and edited. Your windows is working fine as the doors![]()
Regards
Sougata
A little suggestion:
What about a Pause or a kind of bounce killing?
Something like,
Code:IF MEM_l = 2 THEN WHILE MEM_l = 2 : WEND speed = speed + 1 ENDIF OR IF MEM_l = 2 THEN PAUSE 100 speed = speed + 1 ENDIF
Speed increases so fast that it goes crazy!
---------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
The manual and Flotu imply that:
is equivalent toCode:if mem_l = 2 then speed = speed + 1 : gosub game_speed
Code:if mem_l = 2 then speed = speed + 1 gosub game_speed endif
Flotu,
does pbtn = 9 if no button is pushed? If it does then your code is doing what you told it to do - update speed each time through the loop while waiting for the button to be pushed whenever mem_1 is 2,3,4, or 5. See below
Code:MAIN: gosub READ_BTNS if pbtn < 4 and Ctr_L <= mem_l then 'lots of stuff here removed for readability (see his post #1) endif if mem_l = 2 then speed = speed + 1 : gosub game_speed if mem_l = 3 then speed = speed + 1 : gosub game_speed if mem_l = 4 then speed = speed + 1 : gosub game_speed if mem_l = 5 then speed = speed + 1 : gosub game_speed value = value + 1 'To change the "seed" for random # Goto MAIN end
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Thank you for all your remarks.
The END statement was there only for testing purpose; I'm going to remove it.
Yes, Pbtn=9 if no button is pressed.
Well Paul, I think you have found the problem.
Regarding the "IF xxxx THEN yyyy : zzzz", I thought that the "zzzz" would be executed ONLY when the IF statement is true. This is why I wrote it after each IF statement (didn't check this out now - will do this in a few minutes).
I'll come back asap.
Roger
I moved my four IF statements to the "correct place" in my loop and everything goes fine now.
I admit, while searching for hours in the wrong direction, I've lost the overview of the program's cycle.
So let me thank all of you one more time.
I'm finishing some cleanups and port it to a PIC12F683 (it's my first SMD project...).
Finally, I'll end this thread by attaching the ultimate code.
Roger
Bookmarks