v1.2.1 add support for array based for loops


A small update to add support for array based for loops.

The syntax is similar to C++:

for (type elem : array) {
    [do something with "elem"]
}

For example:

struct Ball {
    int x, y, col;
}
Ball[] balls = new Ball[0];
for (int i = 0; i < 10; i++) {
    balls.add(new Ball { x = rnd() * 320, y = rnd() * 240, col = i + 1 });
}
for (Ball ball : balls) {
    color(ball.col);
    circfill(ball.x, ball.y, 12);
}
flip();


Also fixed a bug where intellisense would stop working if you delete a .mot file in vscode.

Files

motc-1.2.1.zip 4.6 MB
Aug 01, 2024

Get MotC

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.