Syntactic Sugar
GoMelan supports different kind of syntactic sugar (shorter ways of writing the same code).
List of supported syntax
var++andvar += 1-> add 1 to varvar--andvar -= 1-> substract 1 from varfor (<variable-declaration> ; <condition> ; <variable-update>)for loop simplification
fn main() -> Bool
{
a: Float = 0.5;
for (i: Float = 0.0; i <= a; i += 0.1) {
if (i > a) {
return false;
}
}
return true;
}Output:
trueDeclare one Float variable.
Loop while i is lower or equal to a.
If there is no problem, the code returns True and otherwise False.
Last updated
Was this helpful?