Commands (miscellaneous)

Here are remaining commands of Perun2 not mentioned on the previous page.


Break

break
Escape the recent loop.

Continue

continue
Escape current iteration of the recent loop.

Error

error error [number]
Exit the Perun2. By default, the exit code of the process is 1. We can call this command with our own integer exit code. However, if it equals 0, the exit code will be set to 1, as zero means correct execution.

Exit

exit
Exit the Perun2 successfully with exit code 0.
popup [string]
Show a small pop-up window with a message.

Print

normalwithin loop
print [list]print
Print strings in log. Every log starts with a new line. This command is not affected by the process flag -s (silent).

Run

run [string]
Run certain command using the default system command-line interpreter. In Windows OS, cmd.exe is used. The command is executed in current working location. Perun2 waits until this command ends and reads its exit code. Success or failure is then judged based on this value. Exit code 0 indicates success, while anything else is considered a failure.

Run With

normalwithin loop
run [list] with [string] run with [string]
This is syntactic sugar for running a process with a file as an argument. It enables easy iteration over multiple argument files. For example, command run 'helloworld.py' with 'python' is an equivalent to run 'python helloworld.py'. Each string of the list argument is treated as one word, so will be surrounded by quotation marks if contains any spaces. The same rule applies to the last argument, but only if it is a path to an executable file and contains an extension at the end.

Run With With

normalwithin loop
run [list] with [string] with [list] run with [string] with [list]
This is further extension of the previous command. We can include additional arguments to the process we run. Each element of the last argument is passed to the process as one argument, even if it is an empty string or consists of multiple words separated by spaces.

Sleep

sleep [number] sleep [period]
Wait for certain period of time. Sleep time is expressed either as an amount of miliseconds or as a period. All these units are integers.

Variable Declaration / Assignment

[variable name] = [value]
Declaration of a variable and its reassignment look exactly the same.

Variable Modification

[variable name] += [value]
[variable name] -= [value]
[variable name] *= [value]
[variable name] /= [value]
[variable name] %= [value]
Numeric, time, period and string variables declared by user can be modified. All five operators apply only to numeric variables. String variables can be increased by another string and this operator works as concatenation. The remaining types of variables work only with operators += and -=. Time variables can be increased and decreased only by periods.