I get the following error when I compile:
Syntax error; Undefined control sequence \EndIf
Code:
\usepackage{algorithm2e}
\begin{algorithm}[h]
\label{FecEncodeAndSendFECUnits}
\caption{Function for Receiving and FEC-decoding FEC-encoded Units of Data}
\KwIn{}
%\KwOut{codeRate}
nrOfPacketsReceived = 0 HIGHEST\_FEC\_UNIT\_NR\_DECODED\_GLOBAL=0 \While{$true$}
currentPacket = ListenToSocketForNewPkt () $ nrOfPacketsReceived++ $ $ currentFecUnit =ExtractValueOfPktHeader(currentPacket, FEC_UNIT_GLOBAL) $ $ currentFecUnitModulo$ = $currentFecUnit$ \% NR\_OF\_PARALLELL\_FEC\_UNITS\_GLOBAL $ $ currentSymbolNr$ = ExtractValueOfPktHeader($currentPacket$, SYMBOL\_NR\_GLOBAL) $ packetForCurrentFecUnitGlobal[$currentFecUnitModulo$][$currentSymbolNr$] = ExtractDataOfPkt ($currentPacket$) \If { $ currentFecUnit$ > $HIGHEST_FEC_UNIT_NR_DECODED_GLOBAL$ OR
( currentFecUnit == 0 AND nrOfPacketsReceived == 1 ) }
ExtractPktHeaderAndPutIntoGlobalFecUnitHeaderValues ()
\EndIf
\If {currentFecUnit > HIGHEST\_FEC\_UNIT\_NR\_DECODED\_GLOBAL }
lastFecUnitModulo = (currentFecUnit -1 ) \% NR\_OF\_PARALLELL\_FEC\_UNITS\_GLOBAL DecodeFECUnit (lastFecUnitModulo, nrOfSrcSymbolsGlobal[lastFecUnitModulo], nrOfTotalSymbolsGlobal[lastFecUnitModulo], symbolSizeGlobal[lastFecUnitModulo], rateOfRedundantPkts[lastFecUnitModulo]) \\
$ HIGHEST\_FEC\_UNIT\_NR\_DECODED\_GLOBAL++$ \
\EndIf
\EndWhile
\end{algorithm}
How do I solve this?

:)I'm confused, I took a look at thealgorithm2edocumentation and found no occurrences of both\EndIfand\EndWhile. It seems the correct syntax of both\Whileand\Ifis slightly different than the one you are using. – Paulo Cereda Aug 07 '12 at 01:09