The following are commands that the Nickle interpreter understands, not actual language constructs. They may be issued only at the top level.
If an expression is issued at the top level, such as 3**4 or 100!,, its value is printed to standard output. If the expression ends with a # sign and another expression, its value is printed in whatever base the second expression evaluates to.
Statements, from expressions terminated by semicolons to complicated control structures, are executed but have no value to print. Statements are not commands but actual syntax, so they may be used in scripts. If a line is ended before it can be sensible as an expression or statement, Nickle will continue until it is a statement, e.g.
The quit command exits Nickle. An optional argument specifies the return value.
The print command provides information such as visibility, type, and value, about a name. It need not be the name of a variable; functions, namespaces, etc. may also be printed.
$ nickle > int x = 2; > print x global int x = 2; > print String public namespace String { public int length (string) <builtin> public string new (poly) <builtin> public int index (string, string) <builtin> public string substr (string, int, int) <builtin> public int rindex (string target, string pattern); public string dirname (string name); } > void function hello() { printf("hello, world\n"); } > print hello void hello () { printf ("hello, world\n"); } >
A defined name can be undefined, e.g.
The load and library commands evaluate a file at runtime like the -f and -l flags, respectively.
The edit command invokes $EDITOR on the name given as an argument. This is particularly useful to change a function while in interactive mode.
The history command retrieves the values of the last ten expressions. With an argument, it instead retrieves the values of that many preceeding values. With two arguments, it retrieves the specified range in history.
$ nickle ... > history $176 20 $177 5 $178 0 $179 12 $180 12 $181 -2 $182 2 $183 2 $184 0 $185 10 $186 32 > history 3 $184 0 $185 10 $186 32 > history 180,185 $180 12 $181 -2 $182 2 $183 2 $184 0 $185 10
These history items may be named and used directly: