- Installing
- Hello World
- Spaces
- Identation
- Basics
- Comments
- Output
- ++ method
- Assignments and types
- Operator Precedence
- String interpolation
- Input
- Simple arithmetic
- Multiline strings
- Assert
- Arrays and literal arrays
- Literal intervals
- If, for, while and repeat-until
- Message sends
- Conversion between basic type values
- Anonymous function
- Evaluating an anonymous function
- Functions with method foreach
- Prototypes
- Packages
- Gradual typing
- Generic prototypes
- Important metaobjects
- The CyanInterpreter prototype
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;