トピック
*J.P.*[P]£ aj2003aj

I help with loops

in general i know how to use loops, but ive never used them,... and now i see the error in my ways, so if anyone has good tips, or ways to correctly use them that would be great. 1 question, do i put a different loop for everything like: @mainloop @walking @jumping @enemy @mainloop i just have no idea..
6そうだね
プレイ済み
返信[1]
親投稿
Javier olakease000
↑↑ | Do you want something like this?
0そうだね
プレイ済み
返信[2]
親投稿
Javier olakease000
Little explanation of loops.
0そうだね
プレイ済み
返信[3]
親投稿
Javier olakease000
Continuation of explanation
1そうだね
プレイ済み
返信[4]
親投稿
*J.P.*[P]£ aj2003aj
ah, now i understand.. thanks, and lol i meant "i need help with loops" lol, i help with loops... great job on explaining, i will be using this for a while now... (this post) i have a lot of probs with my code to fix..
0そうだね
プレイ済み
返信[5]
親投稿
PChicken NerdChicken
DON'T USE LABEL LOOPS! Use WHILE:WEND or REPEAT:UNTIL loops. Label loops are bad coding practices. They do not make as much sense as regular loops to the untrained eye, and do not make use of the label feature correctly. WHILE TRUE <- You can set a condition so that this loop will only run if and during when it is true. You can use CONTINUE and BREAK here, which can't be used in label loops. WEND
2そうだね
プレイ済み
返信[6]
親投稿
Aaron Krondelo
@PCChicken Hey, what exactly is the intended function of labels? Is it just for GOSUB(sub-routines)?
1そうだね
プレイ済み
返信[7]
親投稿
Christofer avalack
im just commenting here so i can refer back to these useful explinations.
1そうだね
プレイ済み
返信[8]
親投稿
*J.P.*[P]£ aj2003aj
exactly.
0そうだね
プレイ済み
返信[9]
親投稿
raimondz raimondzz
@Aaron I think label should only be used for data(READ-DATA-RESTORE-COPY) and to make "switch case"(If you don't know what do i mean, then search in google... the syntax is easy to understand) since smilebasic doesn't support that syntax. For everything else there are already control structures(IF-ELSE-FOR-NEXT-WHILE-WEND-REPEAT-UNTIL). Also "DEF function" replace GOSUB and is superior to it.
0そうだね
プレイ済み
返信[10]
親投稿
*J.P.*[P]£ aj2003aj
DEF is better than GOSUB? ok.
0そうだね
プレイ済み
返信[11]
親投稿
ЩMr.Mo14 mr.mo14
unless you need to use global variables.
1そうだね
プレイ済み
返信[12]
親投稿
PChicken NerdChicken
you can RETURN numbers using DEF.
0そうだね
プレイ済み
返信[13]
親投稿
Aaron Krondelo
@raimondz Thanks, yeah I know what switchcase is.
1そうだね
プレイ済み
返信[14]
親投稿
raimondz raimondzz
@ЩMr.Mo&RK You can use global variables inside DEF unless you declare the same variable with VAR inside it.
1そうだね
プレイ済み