Template2 icon indicating copy to clipboard operation
Template2 copied to clipboard

Document the parsing rules for arithmetic expressions

Open petdance opened this issue 2 years ago • 0 comments

It seems that TT requires spaces around math operators sometimes. For example this runs just fine:

x = 5;

y = x + 2; ' y='; y;
y = x - 2; ' y='; y;
y = x * 2; ' y='; y;
y = x / 2; ' y='; y;

and gives

 y=7 y=3 y=10 y=2.5

However, this fails parsing:

x = 5;
y = x+2; ' y='; y;
y = x-2; ' y='; y;
y = x*2; ' y='; y;
y = x/2; ' y='; y;

on the x-2. Comment that line out, and it also fails on the x/2.

If it's documented somewhere that x-2 is not valid but x - 2 is, I can't find it.

petdance avatar Sep 20 '23 14:09 petdance