Difference between revisions of "SCL Tutorial"
Line 7: | Line 7: | ||
Multiline commands can be written by pressing CTRL-ENTER (or just ENTER when the current command text contains errors). The command history can be browsed with CTRL-UP and CTRL-DOWN. | Multiline commands can be written by pressing CTRL-ENTER (or just ENTER when the current command text contains errors). The command history can be browsed with CTRL-UP and CTRL-DOWN. | ||
− | If the command you write into console results as an ordinary value, it is just printed to the console. Here | + | If the command you write into console results as an ordinary value, it is just printed to the console. Here are couple of examples you can try: |
<pre> | <pre> | ||
> 13 | > 13 | ||
Line 19: | Line 19: | ||
> [1,3,5] | > [1,3,5] | ||
[1, 3, 5] | [1, 3, 5] | ||
+ | </pre> | ||
+ | |||
+ | You can also declare local variables to be used in the commands: | ||
+ | <pre> | ||
+ | > x = 35 | ||
+ | > y = 40 | ||
+ | > x + y | ||
+ | 75 | ||
+ | > x * y | ||
+ | 1400 | ||
+ | </pre> | ||
+ | |||
+ | Also new functions can be defined: | ||
+ | <pre> | ||
+ | > f x = x * x | ||
+ | > f 123 | ||
+ | 15129 | ||
</pre> | </pre> |
Revision as of 11:19, 24 August 2012
Getting started
The easiest way of getting started with SCL is to use SCL console that is included in almost all Simantics-based products. You can open the console by pressing ALT-SHIFT-q and then q and choosing "SCL Console" from the list of views.
SCL console works by executing commands you write into the input box in the bottom of the view. After the command has been written, it can be executed by pressing ENTER. However, this works only if the command contains no syntactic errors. Possible errors are highlighted in the input box and a description of the error is shown when you move mouse on top of the highlighted text.
Multiline commands can be written by pressing CTRL-ENTER (or just ENTER when the current command text contains errors). The command history can be browsed with CTRL-UP and CTRL-DOWN.
If the command you write into console results as an ordinary value, it is just printed to the console. Here are couple of examples you can try:
> 13 13 > 1+2 3 > sin 1 0.8414709848078965 > "Hello " + "world!" Hello world! > [1,3,5] [1, 3, 5]
You can also declare local variables to be used in the commands:
> x = 35 > y = 40 > x + y 75 > x * y 1400
Also new functions can be defined:
> f x = x * x > f 123 15129