Nimrod Programming/First steps
First steps, hello world!
editSo here we are let's start with our very first program. In programming languages it's been a tradition to start by writing an example of the language which displays in the console ."Hello world!", and it would be like this in Nimrod:
echo ("Hello world!")
Now the parenthesis aren't really necessary
Easy, isn't it? If you want to try it just save it to a file with extension .nim (e.g: helloworld.nim) and then compile it, for doing this open a terminal, and issue in the terminal:
cd "yourPath"
Then type:
nim c "filename"
This command will make it compile, then will execute it (that's the job of the "-r" argument), when this is done you'll see in the console "Hello world!".
Understanding and extending
editBut how we did that? Basically we told the PC to print "Hello world!" by writing "echo" (which is what we call a function) and then telling what we wanted to print out if we wanted we could made it write other things:
echo ("It's a good day!")
But we are not limited to one expression we can put as many of them as we want:
echo ("It's a good day!")
echo ("Hello world!")
Compile this (just as we did earlier) and it'll print out into the console:
It's a good day!
Hello world!