Strings
Strings are of the predefined type string
. Literal strings are set
between double quotes.
const a :string = "Hello Alice";
Note: See predefined namespace String
Casting
Strings can be used in contexts where a boolean is expected: an empty
string is then interpreted as false
, and true
otherwise.
const one = "" ? 0 : 1;
const zero = "foo" ? 0 : 1;