which would beif (n := len(a)) > 10:
print(f"List is too long ({n} elements, expected <= 10)")
Code: Select all
Define n, a.s
a = "I am a test string"
If (n := Len(a)) > 10
Debug "Length: " + Str(n)
EndIf
Basically this stores something into a variable if an expression is true. I don't know how this is realized internally and also whether it increases speed or or just for convenience.
What are your thoughts?
Sidenote: Even if this is not useful, how about extending the syntax for loops with a static parameter like
Code: Select all
For n = 1 ToStatic Len(a)
;Do something
Next