LoginLogin
Might make SBS readonly: thread

Label Loops

Root / Submissions / [.]

chickenCreated:

NEVER USE THESE.

@LOOP
 'CODE
GOTO @LOOP
@LOOP
 GCLS
 GOSUB @GAME
 GOSUB @RENDER
 WAIT 1
GOTO @LOOP

@GAME
 'CODE
RETURN

@RENDER
 'CODE
RETURN

lol

Replying to:IAmRalsei
ported from my resource Title:GOTO Loops (chicken rebuttal) description: GOTO loops are better than FOR loops for these reasons: 1. Faster 2. Clearer 3. they both do the same thing (i think) 4. GOTO loops easier to read for people who aren't good at programming and GOTO loops are also faster than every other loop, but that's the only pro over using GOTO over REPEAT UNTIL or WHILE 1 WEND loops. those loops are better at doing specific things. But...that's about it. i've said all i can say about GOTO loops.
Bad Joke About Bob The Builderchicken's resource is so broken bob the builder can't fix it
so what do you think? are GOTO loops or FOR loops better? [poll=p271][/poll] vote on that poll! tags:chicken rebuttal bad jokes roasts GOTO loops FOR LOOPS ARE BAD! tagline:DaSonicMario VS chicken GOTO loops vs every other kind of loop WHICH SIDE ARE YOU ON? images: IMAGE 1: IMAGE 2: IMAGE 3:
FOR loops are confusing

Replying to:MasterR3C0RD
There's nothing inherently wrong with using label loops, but it's better to use WHILE, FOR, REPEAT, etc unless you need to make sure your program runs as fast as possible, since label loops don't prepare you for other programming languages in the future, and usually you don't need to squeeze every bit of speed out of your code in SB so
yes
The Truth
We Have To Go Deeper!
The End?
The End.i don't know how FOR loops work

Replying to:IAmRalsei
ported from my resource Title:GOTO Loops (chicken rebuttal) description: GOTO loops are better than FOR loops for these reasons: 1. Faster 2. Clearer 3. they both do the same thing (i think) 4. GOTO loops easier to read for people who aren't good at programming and GOTO loops are also faster than every other loop, but that's the only pro over using GOTO over REPEAT UNTIL or WHILE 1 WEND loops. those loops are better at doing specific things. But...that's about it. i've said all i can say about GOTO loops.
Bad Joke About Bob The Builderchicken's resource is so broken bob the builder can't fix it
so what do you think? are GOTO loops or FOR loops better? [poll=p271][/poll] vote on that poll! tags:chicken rebuttal bad jokes roasts GOTO loops FOR LOOPS ARE BAD! tagline:DaSonicMario VS chicken GOTO loops vs every other kind of loop WHICH SIDE ARE YOU ON? images: IMAGE 1: IMAGE 2: IMAGE 3:
O, MASTER OF R3C0RD1NG i thought it was seconds faster

Replying to:IAmRalsei
ported from my resource Title:GOTO Loops (chicken rebuttal) description: GOTO loops are better than FOR loops for these reasons: 1. Faster 2. Clearer 3. they both do the same thing (i think) 4. GOTO loops easier to read for people who aren't good at programming and GOTO loops are also faster than every other loop, but that's the only pro over using GOTO over REPEAT UNTIL or WHILE 1 WEND loops. those loops are better at doing specific things. But...that's about it. i've said all i can say about GOTO loops.
Bad Joke About Bob The Builderchicken's resource is so broken bob the builder can't fix it
so what do you think? are GOTO loops or FOR loops better? [poll=p271][/poll] vote on that poll! tags:chicken rebuttal bad jokes roasts GOTO loops FOR LOOPS ARE BAD! tagline:DaSonicMario VS chicken GOTO loops vs every other kind of loop WHICH SIDE ARE YOU ON? images: IMAGE 1: IMAGE 2: IMAGE 3:
FOR loops aren't confusing if you make a small amount of effort to understand them. FOR loops take a variable, reset it to value 1, then take it to value 2, adding whatever the STEP is set to each time. (by default, it just adds one until it reaches value 2)
FOR (variable)=(value 1) TO (value 2) STEP (step)
 PRINT "Hi! ";(variable)
NEXT
FOR I=0 TO 3 STEP 2
 PRINT "Hi! ";I
NEXT
enter that code and see what happens. try changing one thing. try removing the STEP.

Replying to:MasterR3C0RD
There's nothing inherently wrong with using label loops, but it's better to use WHILE, FOR, REPEAT, etc unless you need to make sure your program runs as fast as possible, since label loops don't prepare you for other programming languages in the future, and usually you don't need to squeeze every bit of speed out of your code in SB so
well, if you dont know how a for loop works then why are you even saying they are worse.. its like saying im the best person in the universe without even looking at anyone else or like saying "Bob the builder gAmE iS tHe BeeSt iN thE UniVeRSe and minecraft is so dumb because it has nothing to do" without ever playing minecraft, its just not good, or like disliking someone for no reason without knowing anything about them. label loops can be good in certain situations but honestly if your need it just use another loop or a DEF. also a for loop is not something you would use as a game loop, unless you totally screwed things up they are used for other things. now while wend loops are my fav, but i also use repeat until ones too. use them. use defs. learn them then once you have, come back here and see all your mistakes, or just sty with label loops and never make a good game and have problems for the rest of your hopefully short coding life.

Replying to:Arkzen
Too bad, label loops are the only loops I feel like learning, plus it would take me too long to change my games code to use WHILE loops.
now heres the problem, imagine yourself trying to catch a penny in mid air, but because you are using a label loop it goes too fast and skips the line that catches it making you never able to get it. speed does not always mean "better", also anyone who has used label loops for long enough knows they cause lots of glitches and problems in your programs that are hard to fix, now when i switched to while/wend loops literally all my glitches went away in my program and it was a GREAT thing too. very worth the time to switch your code over. anyways why am i here..? idk, bye.

Replying to:Arkzen
Too bad, label loops are the only loops I feel like learning, plus it would take me too long to change my games code to use WHILE loops.
i ^gr^^. i used to have a heck ton of problems with goto@loops but they mostly went away except me forgetting to define a variable.

fun fact you NEED to use for loops to load a map on screen, at least of what i know, ex:
FOR I=0 TO 3
BGSCREEN I,127,128'(or I,64,64)
NEXT
/the rest of map loading code

Replying to:rando
fun fact you NEED to use for loops to load a map on screen, at least of what i know, ex:
FOR I=0 TO 3
BGSCREEN I,127,128'(or I,64,64)
NEXT
/the rest of map loading code
edit button too small on the end of the code its
'the rest of map loading code

Replying to:rando
fun fact you NEED to use for loops to load a map on screen, at least of what i know, ex:
FOR I=0 TO 3
BGSCREEN I,127,128'(or I,64,64)
NEXT
/the rest of map loading code
actually that only if you want to make it faster and easyer, you can do without it would just be a lot more code. but yes good

Replying to:kitesinpowerlines
I agree and disagree. I think GOTO loops are nice for beginners to understand how loops work (especially if they have no programming experience). With that being said, once you have the basics down it is time to abandon label loops, otherwise you will not grow as a programmer beyond the "beginner" levels.
well...if having a loop that is a few milliseconds slower than a GOTO loop doesn't bother you then use the more advanced loops if you want you game to run AS FAST AS POSSIBLE (like if your making a game about going fast!) use GOTO loops. [EDIT:added ICODE, this message and a dot]

Replying to:kitesinpowerlines
I agree and disagree. I think GOTO loops are nice for beginners to understand how loops work (especially if they have no programming experience). With that being said, once you have the basics down it is time to abandon label loops, otherwise you will not grow as a programmer beyond the "beginner" levels.
I donโ€™t think a few milliseconds will affect gameplay very much at all. I find it hard to believe that your only argument to support your enthusiasm for Label loops is something that you didnโ€™t even know until you saw someone say it a few days ago.

Replying to:kitesinpowerlines
I agree and disagree. I think GOTO loops are nice for beginners to understand how loops work (especially if they have no programming experience). With that being said, once you have the basics down it is time to abandon label loops, otherwise you will not grow as a programmer beyond the "beginner" levels.
Quote from MASTERR3C0RD: "GOTO loops aren't that much more faster. We're talking milliseconds here, which doesn't matter unless you're making a very very advanced game where those milliseconds are the difference between staying above 30FPS or dropping frames like it's hot. So stop being an annoying pest and shut up about things you know nothing about". the key part is:"GOTO loops aren't that much more faster. We're talking milliseconds here, which doesn't matter unless you're making a very very advanced game where those milliseconds are the difference between staying above 30FPS or dropping frames like it's hot." well, more specifically, the "which doesn't matter unless you're making a very very advanced game where those milliseconds are the difference between staying above 30FPS or dropping frames like it's hot."

Replying to:rando
thanks chicken, for showing not to use worse loops. i already knew, but this can help others.
i have a joke idea:edit the for to be CAPITAL and make it use ICODE! it'd be a joke about FOR loops.

Replying to:rando
thanks chicken, for showing not to use worse loops. i already knew, but this can help others.
i have a joke idea: how about you stop commenting every two seconds like this is miiverse or something? it'd be a joke about your inability to read any mood.

Replying to:rando
thanks chicken, for showing not to use worse loops. i already knew, but this can help others.
i have a joke idea:how about you stop thinking i don't know the difference between SBS and Miiverse it'd be a joke about how dumb you are and how smart i am

Replying to:rando
thanks chicken, for showing not to use worse loops. i already knew, but this can help others.
I like how instead of having a point, you now just insult people for no good reason.

Replying to:rando
fun fact you NEED to use for loops to load a map on screen, at least of what i know, ex:
FOR I=0 TO 3
BGSCREEN I,127,128'(or I,64,64)
NEXT
/the rest of map loading code
GOTO can emulate any other loop structure. They exist for convenience, as do the named commands and BASIC itself. Programming as we know it is about abstraction. Anyway, for comparison:
FOR I=0 TO 3
 BGSCREEN I,127,128
NEXT
can be accomplished with this literal jump:
VAR I = 0
@LOOP_1
BGSCREEN I,127,128
DEC I, -1 'for "speed"
IF I <= 3 THEN GOTO @LOOP_1
In addition, a finite loop can be "unwrapped" by writing out every instruction.
BGSCREEN 0,127,128
BGSCREEN 1,127,128
BGSCREEN 2,127,128
BGSCREEN 3,127,128
The counting "FOR" loop allows us to not worry about iterator variables, it handles the increment itself. Most of the "debate" occurring in the comments here seems to be DSM not bothering to learn structures like this. I'm sure he'll choose the unwrapped version when checking all 512 sprites--after all, it's faster that way.

Replying to:rando
fun fact you NEED to use for loops to load a map on screen, at least of what i know, ex:
FOR I=0 TO 3
BGSCREEN I,127,128'(or I,64,64)
NEXT
/the rest of map loading code
DaSonicMario, if you want the most speed for your programs, don't use Python, Lua, or C#! Use Assembly! It's so much faster! Sure you sacrifice a little code readability, but in the end, it's worth it.