Skip to content

Latest commit

 

History

History
57 lines (46 loc) · 1.22 KB

File metadata and controls

57 lines (46 loc) · 1.22 KB

API Reference

This reference documents the globally available built-in functions in TechScript 2.0.


🖨️ Global Functions

say(val)

Prints the string representation of val to stdout, followed by a newline:

say "Hello"
say 42

ask(prompt)

Prints the prompt string to stdout and blocks execution until input is read from stdin. Returns the input as a string:

name = ask "Enter your name: "

len(collection)

Returns the size of a list, map, or string as an integer:

size = len([1, 2, 3]) # 3
char_count = len("Tech") # 4

typeof(val)

Returns a string representing the runtime type of the value ("int", "float", "str", "bool", "list", "map", "null", or custom class name):

say typeof(42) # "int"

sleep(ms)

Suspends thread execution for ms milliseconds:

sleep(1000) # Sleep for 1 second

assert(condition)

Triggers a runtime panic if the condition is false:

assert(1 == 1)

panic(message)

Halts VM execution immediately and prints the error message:

panic "Unrecoverable fatal error occurred"

exit(code)

Exits the process immediately with the specified integer status code:

exit(0)