Skip to content

Instantly share code, notes, and snippets.

@leveled
Last active February 3, 2021 13:20
Show Gist options
  • Save leveled/2e13c8f9225dfc200cea3154822ff740 to your computer and use it in GitHub Desktop.
Save leveled/2e13c8f9225dfc200cea3154822ff740 to your computer and use it in GitHub Desktop.
Declaring variables in nim
var x, y: int # declares x and y to have the type ``int``
var
x, y: int
# a comment can occur here too
a, b, c: string
#Constants
const x = "abc" # the constant x contains the string "abc"
const
x = 1
# a comment can occur here too
y = 2
z = y + 5 # computations are possible
#Let statements - single assignment
let x = "abc" # introduces a new variable `x` and binds a value to it
x = "xyz" # Illegal: assignment to `x`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment