Skip to content

Loops and Goto

S Pradosh edited this page Oct 23, 2022 · 8 revisions

a loop is a sequence of instructions that is continually repeated

Goto Loops

Let's say you need to make a script that adds a number infinitely. you can use goto for that here is a example

the code you want to loop:

{
    +
    ;
}

here is how you add a loop:

{
    +
    ;
    
    goto
    start
}

the goto \n start will make the script run forever

you can even use goto with timers like this:

{
    +
    ;

    sleep
    1000
    
    goto
    start
}

even you can exit the script by using:

{
    +

    goto
    last

    // this code will not run
    ;
}

sep

For Loops

  • For Loop Syntax
    for i=0; i-10; i=+1
        // Code here
    fo-end

i stands for variable name. i-10 means 0 till 10 equivalent to i<10 in C. the i=+1 stands for increment i by 1 equivalent to i++ in C

  • For Loops are also castable Example:
    for i={hexvar1}; i-{hexvar2}; i=+1
        // Code here
    fo-end

πŸ‰ Melon Language Wiki

πŸ˜‰ Simple, πŸ’Ύ Low Level, πŸ‘¨β€πŸ’» PPL


Requirements

[External] Git

[External] C# Runtime

Architecture and OS that Melon Supports

Coding & Learning

Getting Into the coding

Variables

Advanced Calculations

Casting and Incrementing

Timers

Compilation

Loops and Goto

Functions

Conditions

File System

User Input

Importing Files and Library

Graphics

Package System

Configuration

Setup OS X for Melon Language

Setup Melon Language for Windows Terminal

Setup Melon Language for VSCode Terminal

Setup Environment CLI for Melon Language on Windows

Other

Downloads History

✨ WOW! You are at the end! now you are a Melon πŸ‰ programmer! Claim your badge!

Melon

Copy Paste: [![Melon](https://nuag9x4nt640.runkit.sh)](https://github.com/pradosh-arduino/Melon-Language/)

Clone this wiki locally