Veamos un hola mundo:
# This is a comment
echo "What's your name? "
var name: string = readLine(stdin)
echo "Hi, ", name, "!"
Y ahora vamos a compilar:
nim compile --run greetings.nim
Veamos un objeto:
type
Person = ref object of RootObj
name*: string # the * means that `name` is accessible from other modules
age: int # no * means that the field is hidden from other modules
Student = ref object of Person # Student inherits from Person
id: int # with an id field
var
student: Student
person: Person
assert(student of Student) # is true
# object construction:
student = Student(name: "Anton", age: 5, id: 2)
echo student[]
Entre sus características, podemos nombrar:
- Librería estandar
- Garbage Collector
- Procedures
- Iterators
- Enumerations
- Modules
- Generics
- Templates
- Macros
- Compilación a javascript
- Aporia es la IDE con la que se pueden programar.
Dejo link:
http://nim-lang.org/
https://github.com/nim-lang/Aporia