Examples
The following are simple examples of Nit programs. All these examples are available in the examples directory in the compiler archive. For more examples you can look at the standard library source code or the nitc compiler source code.
- hello_world.nit: the standard "hello word" program.
- print_arguments.nit: just repeat the arguments of the program.
- fibonacci.nit: refine Int, the class of all integers, to add a Fibonacci function.
- procedural_array.nit: simple use of arrays without defining new classes.
- clock.nit: a simple class to track time on a wall clock.
- clock_more.nit: refine clock to add comparability between clocks.
- circular_list.nit: simple use of generic classes and nullable types to implement a double-linked circular list.