Files
fz-lang/exl/class.fzs
T

37 lines
538 B
Plaintext

class Point
{
int x;
int y;
// Move point by [dx,dy]
fn move(int dx, int dy) {
this.x = this.x + dx;
this.y = this.y + dy;
}
}
Point obj = new Point;
obj.x = 1;
obj.y = 2;
printline("Current X,Y:");
printline(obj.x);
printline(obj.y);
// NOTE: WHY THE FUCK THIS FUCKING COMPILER REQUIRES ';' AFTER '='?!
// |
// v
obj.move(9, 8);
printline("X,Y after move:");
printline(obj.x);
printline(obj.y);
if (obj.x == 10 && obj.y == 10)
printline("Test passed");
else
{
printline("Test failed");
exit(1);
}