Built-in functions
Falx has exactly five global functions, always available with no require needed. This is the complete list - there are no others.
Prints value to standard output, followed by a newline. Not variadic - if you pass more than one argument, only the first is printed and the rest are silently ignored; calling it with zero arguments prints a blank line.
output("hi"); // hi
output(); // (blank line)
output("a", "b"); // a - "b" is ignored, not an error
See how values print for the exact formatting of arrays, maps and strings.
Falx's only input function - it is a prompt-and-read, not an HTTP request despite the name. Prints prompt with no trailing newline, reads one line from standard input, and returns it as a string. Requires exactly one argument.
let name = request("Enter your name: ");
output("Hi " + name);
Returns the type name of value as a string. See the full table on Variables & Types - for a struct instance this is the struct's own name, not a generic "struct".
output(typeof(1)); // "number"
output(typeof("x")); // "string"
output(typeof([])); // "array"
Raises a runtime AssertionFailedException if condition is falsy, with the optional message as its text. Requires at least one argument. condition's truthiness is checked with the value's own boolean conversion - the same rule while and &&/|| use (see Truthiness), not the more limited rule if uses. That means assert(1) doesn't fail because 1 "isn't true" - it raises a different error entirely (Cannot convert 'number' to bool), because numbers have no boolean conversion at all. Pass an actual boolean expression.
assert(2 + 2 == 4);
assert(user.isAdult(), "user must be an adult");
assert(false); // runtime error: assertion failed
Loads another .flx file as a module and returns its exported (i.e. every top-level) declaration as a single value. See Modules for the full path-resolution rules.