Language Basics
This page introduces the syntax you will use most often as a beginner.
Statements and semicolons
Section titled “Statements and semicolons”Semicolons are optional.
print("Hello")print("Hello again");Comments
Section titled “Comments”Single-line comments:
# This is a commentprint("Visible output") # Inline commentMultiline comments:
#--This block is ignored.#--print("done")Variables
Section titled “Variables”Use var to define variables.
var age = 25var height = 1.75var name = "Alice"Reassign values when needed:
var score = 10score = 12Optional type annotation syntax:
var title = "Numo" :: StringPrinting and panic
Section titled “Printing and panic”Both print styles are accepted:
print "Hello"print("Hello")Stop execution with panic:
panic("Something went wrong")Expressions
Section titled “Expressions”Current core expression support includes:
- Numbers
- Strings
- Variables
- Function calls
+operator
var a = 10var b = 20print(a + b)print("Hello, " + "Numo")Functions
Section titled “Functions”Define functions with func.
func greet(name) { print("Hello, " + name)}
func ping() { print("pong")}
greet("Numo")ping()Current implementation supports zero or one parameter.
Imports and modules
Section titled “Imports and modules”Import built-in modules like this:
get math from "internal:math"print(math.pi())Try a small mixed example:
get math from "internal:math"get str from "internal:string"get sys from "internal:system"
var name = "numo"print("Language: " + str.upper(name))print("PI: " + math.pi())print("Platform: " + sys.platform())