Welcome to Night!
Here you'll find all the necessary resources to get started.
The links above provide quick access to important information, while the description below will give
an overview of this language.
Enjoy!
About
Night is a high level interpreted language built around safety. Being gradually typed, combined with a robust and safe type system, Night is a simple yet powerful language.
Here's a little sample of Night code:
# fib sequence using recursion
def fib(num)
{
if (num <= 1)
return num
return fib(num - 1) + fib(num - 2)
}
# storing fib numbers in an array
let fib_nums = [ fib(5), fib(6) ]
fib_nums.push(fib(7))
# displaying numbers
for (num : fib_nums)
print(num + " ")
Safety
A major advantage Night has over other dynamically typed language is its
compile time checks.
Whereas a language like Python does not provide type
checking and many other declaration checks, Night fills this gap, eliminating
hidden runtime bugs and providing safer code.
def divide(x, y)
{
return x / y
}
if (false)
{
a = divide(10, 2) # error! 'a' is undefined
let b = divide("s", 2) # error! 's' is an invalid argument type
}