| 1 |
\Fn(\tcc*[h]{algorithm as a recursive function}){\FRecurs{some args}}{ |
| 2 |
\KwData{Some input data\\these inputs can be displayed on several lines and one |
| 3 |
input can be wider than line's width.} |
| 4 |
\KwResult{Same for output data} |
| 5 |
\tcc{this is a comment to tell you that we will now really start code} |
| 6 |
\If(\tcc*[h]{a simple if but with a comment on the same line}){this is true}{ |
| 7 |
we do that, else nothing\; |
| 8 |
\tcc{we will include other if so you can see this is possible} |
| 9 |
\eIf{we agree that}{ |
| 10 |
we do that\; |
| 11 |
}{ |
| 12 |
else we will do a more complicated if using else if\; |
| 13 |
\uIf{this first condition is true}{ |
| 14 |
we do that\; |
| 15 |
} |
| 16 |
\uElseIf{this other condition is true}{ |
| 17 |
this is done\tcc*[r]{else if} |
| 18 |
} |
| 19 |
\Else{ |
| 20 |
in other case, we do this\tcc*[r]{else} |
| 21 |
} |
| 22 |
} |
| 23 |
} |
| 24 |
\tcc{now loops} |
| 25 |
\For{\forcond}{ |
| 26 |
a for loop\; |
| 27 |
} |
| 28 |
\While{$i<n$}{ |
| 29 |
a while loop including a repeat--until loop\; |
| 30 |
\Repeat{this end condition}{ |
| 31 |
do this things\; |
| 32 |
} |
| 33 |
} |
| 34 |
They are many other possibilities and customization possible that you have to |
| 35 |
discover by reading the documentation. |
| 36 |
} |