Gusarich / housify

Housify is an advanced programming language and compiler specifically designed for Hypixel Housing
MIT License
3 stars 0 forks source link

Loops #32

Open Gusarich opened 3 months ago

Gusarich commented 3 months ago

Loops are very useful and are almost essential for most of programming languages. Many people wanted to have loops in Housing.

Suggested syntax:

let x: int = 0;
while (x < 10) {
    x = x + 1;
    // body
}
let x: int = 0;
do {
    x = x + 1;
    // body
} until (x < 10);
for (let i: int = 0; i < 10; i = i + 1) {
    // body
}

Resolving this issue is mostly about finding a good way to implement simple while loop and then just using the same logic for do-until and for loops.