Scripting
1 If Edit
<if test="1+1==2">one plus one is two</if>
becomes
one plus one is two
2 Variables Edit
<def name="answer" value="4*10+2"/> The answer is <value of="answer"/>.
becomes
The answer is 42.
2.1 Predefined variables Edit
- page_name: Scripting
- page_path: Scripting
- page_title: Scripting
- page_version: f3ccfe151d1befc27cb6d5e4e9fe8620bd533c16
- page_next_version:
- page_previous_version: 28cdb6194381055741f77c96f1fcc63bf609d497
- page_mime: text/x-creole
- page_modified: false
3 Functions Edit
Functions can be defined with "def".
<def name="fac" args="n"> <if test="n>1"> <call name="fac" n="n-1" result="m"/> <value of="n*int(m)"/> </if> <if test="n==1">1</if> </def> <call name="fac" n="20"/>
results in
2432902008176640000
<def name="fac2" args="n m"> <if test="n==1"><value of="m"/></if> <if test="n>1"><call name="fac2" n="n-1" m="n*m"/></if> </def> <call name="fac2" n="20" m="1"/>
results in
2432902008176640000
4 Loops Edit
Multiplication table:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |
| 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 |
| 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 |
| 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 |
| 6 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 54 | 60 |
| 7 | 14 | 21 | 28 | 35 | 42 | 49 | 56 | 63 | 70 |
| 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 |
| 9 | 18 | 27 | 36 | 45 | 54 | 63 | 72 | 81 | 90 |
| 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 |
Multiplication table #2:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |
| 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 |
| 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | 40 |
| 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 |
| 6 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 54 | 60 |
| 7 | 14 | 21 | 28 | 35 | 42 | 49 | 56 | 63 | 70 |
| 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 |
| 9 | 18 | 27 | 36 | 45 | 54 | 63 | 72 | 81 | 90 |
| 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100 |
Counter:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10