I am using
\usepackage[norelsize, linesnumbered, ruled, lined, boxed, commentsnumbered]{algorithm2e}
\RestyleAlgo{boxruled}
It seems that algorithm2e
has the default repeat-until construct.
But I want to use do-while construct as do something while(u is not v).
The repeat-until construct is different from the do-while construct.
My search resulted in do-while loop in pseudo code. But the answer is for algorithmicx
.
How this can be done in `algorithm2e?
Best Answer
You can create a do-while construct using the same technique that a repeat-until construct is generated. They both fall under what
algorithm2e
calls "Repeat macros":The above now allows you to use
Here is a minimal example showing its use/output: