string interpolation

String interpolation

In a string, a $ not preceded by a \ should be followed by a valid identifier. The identifier should be a parameter, local variable, or field of the current prototype. The result is that the identifier is converted at runtime to a string (through the asString method) and inserted into the string.

var v = 0;
var s = "var v = $v (zero);
assert s == "var v = 0 (zero)";

This is equivalent to

var v = 0;
var s = "var v = " ++ v ++ " (zero);
assert s == "var v = 0 (zero)";

The methods == (eq) and != (neq) return a boolean type depending on the compile-time value of the argument and self. That is, those methods compare two strings and verify if they are equal or not.

var String a = “equal” var String b = “unequal” var String c = “equal” assert a != b; assert a == c;

The assert method will be explained in the next sections of this tutorial. For understanting reasons, let’s assume that it verifies the truthness of the expression.