I am using \usepackage{pseudocode}
in LaTeX for writing pseudocode.
How to write switch statement using this package?
I write more 90% pseudocode using the package pseudocode. In function Validate i want to write switch Statement.
\PROCEDURE{Validate}{location1,location2}
l1 \GETS 0 \\
l2 \GETS 0 \\
validate \GETS true \\
\IF board[location1] \neq 0 \THEN
\BEGIN
l1 \GETS board[location1]
l2 \GETS board[location2]
\IF l1 + l2 is odd and l2 \neq 0 \THEN
validate \GETS false
\ELSE
\BEGIN
%\SWITCH here i want to write switch statement
%\BEGIN
%\END
\END
\END
\RETURN {validate}\\
\ENDPROCEDURE
I can find add switch statement in pseudocode using other packages like algorithmicx and algorithm. There is any way to add switch statement using pseudocode package ?
Best Answer
I'm really not sure whether this is what you're after, but it's a first go:
The constructions used by
pseudocode
is based onarray
s, so it's easily modifiable. However, it depends on what you're after in terms of the look of a\SWITCH
command, in terms of placement, alignment and justification.