Nift has its own in-built template language
Contents
n++ interpreter
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
You can switch to one of the other languages available in Nift's interpreter using
n++ shell
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
You can switch to one of the other languages available in Nift using
Running n++ scripts
If you have an
nsm run path/script-name.n nift run path/script-name.n
If the script has a different extension, say
nsm run -n++ path/script-name.ext nift run -n++ path/script-name.ext
If you want to run a normal file, eg.
#!/usr/bin/env nift
There's information about "run commands" scripts, eg.
n++ from f++
You can run
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
@funcName{options}(params)
Examples
The following script will create and delete 100k files on your machine:
#!/usr/bin/env nift @string(params = "file0.txt"); @for(int i=1; i<100000; i+=1) $`params += ', file$[i].txt'`; @poke($[params]); @rmv($[params]);
Note: do not leave the directory you are running the script from open on your machine, run it from a terminal/command prompt. The following bash script will do the same but much slower, feel free to provide a similar windows script in powershell or a batch file:
#!/usr/bin/env bash COUNTER=0 while [ $COUNTER -lt 100000 ]; do let COUNTER=COUNTER+1 touch file${COUNTER}.txt rm file${COUNTER}.txt done