Skip to content

Variables

Variables in Zink are declared with let. They are dynamically typed — no type annotations needed.

Declaration

zink
let x = 42
let name = "Alice"
let active = true
let nothing = null

Reassignment

Variables can be reassigned to any type:

zink
let x = 10
say x        # 10

x = "hello"
say x        # hello

Types

Zink has five value types:

TypeExampleNotes
Number42, 3.1464-bit floating point
String"hello"Double-quoted, with interp.
Booleantrue, falseLogical values
NullnullAbsence of a value
Array[1, 2, 3]Ordered, dynamic-length

Naming Rules

  • Must start with a letter or underscore
  • Can contain letters, digits, and underscores
  • Case-sensitive (nameName)
zink
let my_var = 1       # ok
let _private = 2     # ok
let camelCase = 3    # ok

Scope

Variables declared inside a block ({ }) are local to that block:

zink
let x = "outer"
if true {
  let x = "inner"
  say x              # inner
}
say x                # outer

Released under the MIT License.