Next: Declarations, Up: Syntax
All statements in Kite end with a semicolon. For instance:
"Hello world"|print;
Whitespace also does not matter, for the most part. "hello world" | print ;
is equivalent to the first line above. Brackets are used to delineate blocks.
Numbers are represented as in other languages (integers have no periods, while floating-point numbers have one). Strings are surrounded by double quotes, and have the normal escapes:
\n
\r
\\
\"
\t
\b
\f
\[0-7][0-7]?[0-7]?
\x[0-F][0-F]?
Strings can also span multiple lines without the need for any escape character.
Lists are surrounded by [
and ]
characters, with each element
separated by commas: [1,2,3]
. All built-in types are immutable, except
for lists. Boolean values are true
and false
(for true and false,
respectively).
As of 1.0b8, it's also possible to specify a range of integers by using the
following construct: from:to(:step)
. This will instantiate a
System.math.range object (see kdoc documentation) that represents all the
numbers from one integer to another (possibly skipping numbers along the way).
Regular expressions are also built-into the language syntax as of 1.0.1. Regular expressions begin with "r/" and end with either "/" (case-sensitive) or "/i" (case-insensitive). This is equivalent to creating a new System.regex object with the appropriate parameters.