ScratchScript 1.0 Help

Control flow

ScratchScript incorporates control flow structures from both languages. This includes for loops from TypeScript and repeat loops from Scratch.

If/else

if(condition) { // ... } else if(condition2) { // ... } else { // ... }

While

while(condition) { // ... if(breakCondition) { break; } }

Repeat

repeat(times) { // times must be a number // ... if(breakCondition) { break; } }

For

Like in Typescript, for loops have the syntax for(definition; condition; change):

for(let x = 0; x < 100; x++) { // ... if(breakCondition) { break; } }
Last modified: 02 мая 2024