n++

## Nift's in-built template language n++

Nift has its own in-built template language n++. The n comes from Nift/nsm, while the ++ comes from the language being developed in c++.

[contents]

#### n++ interpreter

Nift has an n++ interpreter that you can start with either nsm interp -n++ or nift interp -n++.

In the interpreter mode the prompt will just tell you which language you are using. If you would like the prompt to also display the present working directory (up to using half the width of the console) you can switch to the shell mode using nsm_mode("sh"). You can switch back again with nsm_mode("interp").

You can switch to one of the other languages available in Nift's interpreter using nsm_lang(langStr) where langStr is one of f++, n++, lua or exprtk.

#### n++ shell

Nift has an n++ shell that you can start with either nsm sh -n++ or nift sh -n++.

In the shell mode the prompt will tell you which language you are using and the present working directory (up to using half the width of the console). If you would like the prompt to just display the language you can switch to the interpreter mode using nsm_mode("interp"). You can switch back again with nsm_mode("sh").

You can switch to one of the other languages available in Nift using nsm_lang(langStr) where langStr is one of f++, n++, lua or exprtk.

#### Running n++ scripts

If you have an n++ script saved in a file path/script-name.n you can run it with either of the following:

nsm run path/script-name.n
nift run path/script-name.n


If the script has a different extension, say .ext, you can run the script with either of the following:

nsm run -n++ path/script-name.ext
nift run -n++ path/script-name.ext


#### n++ from f++

You can run n++ code from f++ using either of the following:

n++(/* single line of n++ code */)


n++
{
// block of n++ code
}


#### Nift functions

All of Nift's hard-coded functions (including functions for defining variables, functions and structs) are available in your n++ code. The syntax for calling a function is as follows:

@funcName{options}(params)


Note: One of the main differences between f++ and n++ are that function calls in n++ must start with an @ in front of the function name. However it is okay for there to be an @ in front of the function name for a function call in f++. Consequently quite often valid n++ code is valid f++ code, which among other things allows us to conveniently use f++ for things like n++ if/else-if/else/while/for/etc. conditions and if the developer accidentally uses n++ for the condition it will most often run without any syntax or semantic errors.