Nim

Print

var name: string = "world"
echo "Hello ", name, "!"

Variables

var x: int = 4
let x: int = 4
const x: int = 4

Data types

# basic types
let x: int
let x: string
let x: bool

# tuple
let x = tuple[name: string, age: int]

# enum
let Color = enum cRed, cBlue, cGreen

Operators

# Logical operators
== # equal
!= # not equal
and # AND
or # OR
xor # XOR

Control flow

# if-else
if a > b:
    # statement
elif a == b:
    # statement
else:
    # statement

Functions

# procedure
proc printNumber(i: int) =
    echo i

# function
func add(x: int, y: int): int =
    x + y