Link Search Menu Expand Document

Built-in

Table of contents

  1. Built-in variables
    1. __file__
  2. Built-in functions
    1. print(…values)
    2. printError(…values)
    3. input(String: prompt -> Optional) -> String
    4. type(value) -> String
    5. assert(Boolean)
    6. isDefined(String) -> Boolean

Built-in variables

__file__

The path name of the compilation unit.

Built-in functions

Global functions which are built into Dictu.

print(…values)

Prints a given list of values to stdout.

print(10); // 10
print("test"); // "test"
print(10, "test", nil, true); // 10, "test", nil, true

printError(…values)

Prints a given list of values to stderr.

printError(10); // 10
printError("test"); // "test"
printError(10, "test", nil, true); // 10, "test", nil, true

input(String: prompt -> Optional) -> String

Gathers user input from stdin and returns the value as a string. input() has an optional prompt which will be shown to the user before they enter their string.

input();
input("Input: ");

type(value) -> String

Returns the type of a given value as a string.

type(10); // "number"
type(true); // "bool"
type([]); // "list"

assert(Boolean)

Raise a runtime error if the given boolean is not true.

assert(10 > 9);
assert(9 > 10); // assert() was false!

isDefined(String) -> Boolean

Returns a boolean depending on whether a variable has been defined in the global scope.

isDefined("isDefined"); // true
isDefined("garbage value"); // false

This site uses Just The Docs, with modifications.