Discuss Scratch

Scratch3er4
Scratcher
10 posts

Why is the Forever block not a stack block?

I wonder why the forever block is not a stack block…

Forever Block as a Cap Block:
forever

Forever Block as a Stack Block:
forever

Last edited by Scratch3er4 (March 11, 2025 07:54:30)

NotK3ndricAltAgain
Scratcher
500+ posts

Why is the Forever block not a stack block?

Because it runs the code inside it forever, which makes it a C cap. However, the Repeat block is a C stack, because it only repeats the code inside it a certain number of times.

Last edited by NotK3ndricAltAgain (March 11, 2025 07:58:29)

lAZERbREAD
Scratcher
22 posts

Why is the Forever block not a stack block?

well, what's gonna happen after forever?
GameCatastrophe0927
Scratcher
1000+ posts

Why is the Forever block not a stack block?

lAZERbREAD wrote:

well, what's gonna happen after forever?
Nothing? If the forever block was a stack and you put code after it, that code will never run

Last edited by GameCatastrophe0927 (March 11, 2025 14:26:06)

HopTheHammer
Scratcher
5 posts

Why is the Forever block not a stack block?

I guess probably because you wouldn't need more than one forever block on on script.

Also maybe because since it's forever, nothing may come after it.
AmpElectrecuted
Scratcher
1000+ posts

Why is the Forever block not a stack block?

you could stop a forever loop using
stopthis script

however, most people won't know that and will get confused
KitKat341b
Scratcher
500+ posts

Why is the Forever block not a stack block?

Because the code in a forever loop runs… well, forever, so whatever happens after it will just never run. Unless you use
stop this script

but like AmpElectrecuted said, that could get confusing.
BigNate469
Scratcher
1000+ posts

Why is the Forever block not a stack block?

There's no way to make anything run after it- Scratch doesn't have a break statement, and stopping the script will stop the script without anything below it running. So there's no point in it being a stack block.
NMario84
Scratcher
1000+ posts

Why is the Forever block not a stack block?

It makes PERFECT sense that Forever block only works as a cap block.
As the name suggests, everything inside the forever loop will run basically infinite times, until you make a script that stops the forever loop.

Making a forever block a stack block is like saying trying to go beyond an infinite amount of times, which is logically impossible.
Scratch137
Scratcher
1000+ posts

Why is the Forever block not a stack block?

AmpElectrecuted wrote:

(#6)
you could stop a forever loop using
stopthis script

however, most people won't know that and will get confused
That still wouldn't run any code after the loop, though. It stops the entire script, not just the current loop.
AmpElectrecuted
Scratcher
1000+ posts

Why is the Forever block not a stack block?

Scratch137 wrote:

(#10)

AmpElectrecuted wrote:

(#6)
you could stop a forever loop using
stopthis script

however, most people won't know that and will get confused
That still wouldn't run any code after the loop, though. It stops the entire script, not just the current loop.
oh my memory is a bit fuzzy. you could put the loop in a custom block though and it would work
BigNate469
Scratcher
1000+ posts

Why is the Forever block not a stack block?

AmpElectrecuted wrote:

Scratch137 wrote:

snip
oh my memory is a bit fuzzy. you could put the loop in a custom block though and it would work
This is true, but that's already possible:
definerunforeverloopforeverstopthis scriptwhenclickedrunforeverloopsayHello!
will almost immediately say “Hello!”.

Powered by DjangoBB