Skip to content
zenonet edited this page May 7, 2022 · 4 revisions

Works in: v0.3+

You can put parts of your code in brackets [] to create a loop. This loop will run until the selected colors sus-meter turns 0. For example this code will print the letter A 7 times:

sus cyan //select cyan as the counter-variable

//Bring its value to 7:
cyan killed
cyan wasWithMe
cyan wasWithMe
cyan wasWithMe

sus red //Select red as the letter we want to print

//Bring its value to the letter A
red killed
red killed
red killed
red killed
red killed
red killed
red vented
red vented
red vented
red vented
red vented

//Start the loop

[
    sus red    //Select red
    emergencyMeeting    //Output the value
    sus cyan    //Select cyan
    cyan wasWithMe //Decrease cyan (the counter) by 1
    
    //Here, it's important that cyan is the last color to be selected since
    //It should be the color tested by the loop
]

Of course we can also modify the letter we want to print inside of the loop. This will print the first 7 letters of the alphabet:

sus cyan //select cyan as the counter-variable

//Bring its value to 7:
cyan killed
cyan wasWithMe
cyan wasWithMe
cyan wasWithMe

sus red //Select red as the letter we want to print

//Bring its value to the letter A
red killed
red killed
red killed
red killed
red killed
red killed
red vented
red vented
red vented
red vented
red vented

//Start the loop

[
    sus red    //Select red
    emergencyMeeting    //Output the value
    red vented    //Increase the value by 1
    sus cyan    //Select cyan
    cyan wasWithMe //Decrease cyan (the counter) by 1
    
    //Here, it's important that cyan is the last color to be selected since
    //It should be the color tested by the loop
]

We can also use loops to more easily get to a certain value. For example to get to the letter d(100 in ASCII) you can just do this:

sus lime
lime killed
[sus red red killed sus lime lime wasWithMe]

sus red
emergencyMeeting

In this example, we can just do it without ever modifying red outside of the loop. But this only works because lime (the color selected before) didn't have a value of 0. Otherwise, the loop wouldn't get called once.

Clone this wiki locally