Login
Community
DARK THEME

"1" + "2" = "12", but "1" - - "2" = 3

I hope it helps ;)

Haha, nice find!

good to know :)

String and number types in microScript are inherited from the same JavaScript types and mostly behave the same way. Including some weird stuff like this!

Having the + operator working to concatenate strings (like in JavaScript) is cool and not cool at the same time, because of the ambiguity you are just pointing, and also because it could be quite a big slow down factor for a future microScript to C transpiler. Sometimes I am thinking of creating a dedicated operator for string concatenation (like | maybe?) and also deprecating the use of + for strings at some point.

What about & as in VB ?

I think that | or & both would work pretty well. You could also do str.join(str1,str2) or something similar.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community