Nimrod Programming/First steps
< Nimrod Programming
First steps, hello world!Edit
So 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 extendingEdit
But 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:
Compile this (just as we did earlier) and it'll print out into the console:
It's a good day!
Retrieved from "https://en.wikibooks.org/w/index.php?title=Nimrod_Programming/First_steps&oldid=3909794"
Last edited on 9 July 2021, at 22:10