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 object. The result is that the identifier is converted at runtime to a string (through the asString method) and concatenated to the string.

var v = “any value”;
"value = $v";

results in value = any value, which is equivalent to

“value = “ ++ v

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.

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.