What’ s new in Nuts 3?

There’s no any new command that was added to Nuts 3. All commands in Nuts 3 already existed in Nuts 2. In, new subroutines were added instead. Subroutines are absent in Nuts 1 but they’re present in Nuts 2 and Nuts 3. There are 20 subroutines supported in Nuts 3.

Remember, these subroutines were added to make Nuts programming easier. In Nuts 3, things may be done the easiest way compared to Nuts 2. You can call a subroutine with a Nuts command but not with another subroutine. Instead, you can call a subroutine within another. To call a subroutine with a Nuts command you have to set its name to the dst. To call a subroutine with in your own subroutine you have to make use any Nuts command but make sure the then variable remain unchanged at the end.

How to make a Hello world program with Nuts 1.

1. Hello 

Set dst=hello1 

Nuts

2. Hello1

Set dst=hello2

Set emt=Hello World!

Emt

3. Hello2

Set dst=exit

Brk

As it is shown above, a hello world program in Nuts 1 should possess atleast 3 Nuts files. If you want your software name to be 'Hello', then it means the first Nuts file should be called 'Hello'. In addition, it should possess the nuts command as to switch to the Nuts Programming Environment.

If the software is 'Hello’, the second file is to be called 'Hello1'. In the first Nuts file, the dst value should be 'Hello1'. In 'Hello1' dst value is 'Hello2'. In the example above, 'Hello2’ possess the 'brk' command. you may use any other command that prevents the software from exiting as it displays the text on the screen.

How to make a Hello world program with Nuts 2.

1. Hello

Set dst=emt

brk

Set then=exit

Set emt=Hello World!

Nuts

The two example above show the difference between Nuts 1 and Nuts 2. In Nuts 1, a hello world program should possess atleast three Nuts files while in Nuts 2, this program may even possess a single Nuts file. If you want your software name to be 'Hello', then it means that you only need a Nuts file called 'Hello'. In addition, it should possess the nuts command as to switch to the Nuts Programming Environment. For Nuts 3, the way a hello world program is made in Nuts 2 is the same it is made in Nuts 3.

In the software ‘Hello’ the dst is set to emtbrk. The emtbrk subroutine once execute it display the emt value on the screen and suspends the execution until the user presses any key to continue. In Nuts, whenever a subroutine finishes the execution it doesn’t go to the ‘dst’ value but the ‘then’ value. So, in the above example the software ‘Hello’ needs the command Nuts to switch to the Nuts programming environment. Before calling the emtbrk subroutine you need to set the emt variable and the then variable. The emt value is what may be displayed on the screen and the then value is where the execution will go after the execution of any subroutine in Nuts.

Post a Comment

0 Comments