A few basic examples

From Remeis-Wiki
Revision as of 09:28, 21 January 2020 by Grinberg (talk | contribs)
Jump to navigation Jump to search


This page is intended to give a few examples for students (mainly students working with Victoria, but the rest is welcome to use it!), who have little to no coding background.

A good convention is to always use filenames that end in .sl for your scripts. You can then run the script using isis filename.sl from the console. Always end your script with exit; so that it exists once it has finished running.

Let's write a simple scripts that says "hello world"!

print("hello world");
exit;

You can get more information on any command by starting isis (just type isis in the console) and entering help commandname, e.g., help print.

Now that we said hello to the world, we'll address some maths first.

Define a variable x that equals 7.5:

variable x;
x = 7.5;

Above, the first line defines an empty variable that does not yet have a type. The second line assigns this variable a value, 7.5, and automatically assigns it a corresponding type. In this case a double.

You can also define a variable and make it equal something in one go:

variable x = 7.5;