Difference between revisions of "A few basic examples"
Line 5: | Line 5: | ||
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. | 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 <code>.sl</code> for your scripts. You can then run the script using | + | A good convention is to always use filenames that end in <code>.sl</code> for your scripts. You can then run the script using <code>isis filename.sl</code> from the console. Always end your script with <code>exit;</code> so that it exists once it has finished running. |
− | isis | + | 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 <code>isis</code> in the console) and entering <code>help commandname</code>, e.g., <code>help print</code>. | ||
+ | |||
+ | 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; | ||
+ | |||
+ | You can also define a variable and make it equal something in one go | ||
+ | |||
+ | variable x = 7.5; |
Revision as of 09:26, 21 January 2020
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;
You can also define a variable and make it equal something in one go
variable x = 7.5;