NIM Language Example
  • NIM Language Example

NIM Language Example

With Input

IF Statement

let name = readLine(stdin)
if name == "":
  echo "Poor soul, you lost your name?"
elif name == "name":
  echo "Very funny, your name is name."
else:
  echo "Hi, ", name, "!"

Without Input

Hello World

echo "Hello World!"

Maximum Number

let x = [1, 4, 2, 3, 5, 8, 9, 7, 6, 0]
var max = x[0]
for i in 1..high(x):
  if max < x[i]:
    max = x[i]

echo "Nilai maksimal : ", max

Swap Value

var x, y, temp: int
x = 3
y = 2
# show initial value
echo "x ", x
echo "y ", y
# swaping
temp = x
x = y
y = temp
# show swap value
echo "x ", x
echo "y ", y
Last Updated: 6/25/25, 4:50 AM
Contributors: Bervianto Leo Pratama