| 1 |
\Fn(\tcc*[h]{algorithm as a recursive function}){\FRecurs{some args}}{ |
| 2 |
\KwData{Some input data} |
| 3 |
\KwResult{Same for output data} |
| 4 |
\If(\tcc*[h]{a simple if but with a comment on the same line}){this is true}{ |
| 5 |
we do that, else nothing\; |
| 6 |
\lIf{we agree that}{we do that} |
| 7 |
\Else{ |
| 8 |
\lIf{this first condition is true}{we do that} |
| 9 |
\lElseIf(\tcc*[h]{else if}){this other condition is true}{this is done} |
| 10 |
\lElse(\tcc*[h]{else}){in other case, we do this} |
| 11 |
} |
| 12 |
} |
| 13 |
\lFor{\forcond}{a for loop} |
| 14 |
\While{$i<n$}{ |
| 15 |
a while loop including a repeat--until loop\; |
| 16 |
\lRepeat(\tcc*[h]{a comment}){this end condition}{do this things} |
| 17 |
} |
| 18 |
They are many other possibilities and customization possible that you have to |
| 19 |
discover by reading the documentation. |
| 20 |
} |