[Tex/LaTex] ! Undefined control sequence. \elf

algorithms

I am trying to open an if statement after entering this if statement\eIf{$list size > 0$} at the position \elf{$stopAfterNext$ is not empty} but I am getting the error below. I can compile the document just if I remove the slash from elf{$stopAfterNext$ is not empty}. How can I fix it?

Error:

! Undefined control sequence.
<recently read> \elf
l.26 }

Code:

\documentclass{article}
%\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\usepackage[]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{latitude, longitude, mac, route, direction}
%\KwResult{how to write algorithm with \LaTeX2e }
 initialize $list$ as an empty  list of integers. \\
%\While{not at end of this document}{
%read current\;
$list$ = Get stop Order from behaviour; \\
\eIf{$list size > 0$}{
  find the last stop name in the behaviour table of this mac;\\
   find the $stop\_id$ of the current location; \\
  find all possible avialable next stops of this
                 $stop\_id$; \\

      calculate the distance to all after next;\\   
  insert the result into after next;    \\  
  String $stopAfterNext$ = check  $stop\_name$ with $stop\_distance < 150$ in after next table; \\
  \elf{$stopAfterNext$ is not empty}{ \\
  String $stopBetween$ = find the name in the stops table;\\

  }          
}{
  find the closet stop of the producer current location; \\
  insert it into next table; \\
  find initializer; \\
  \eIf{initializer is available}{
     get the initializer stop name;  \\
     restore all stop name for this mac to the behaviour table;

  }

}
\caption{Detection algorithm.}
\end{algorithm}

\end{document}

Best Answer

I'm not so sure if this is the output you expect but this compiles error-free:

enter image description here

\documentclass{article}
\usepackage[]{algorithm2e}
\begin{document}
\begin{algorithm}[H]
\SetAlgoLined
\KwData{latitude, longitude, mac, route, direction}
%\KwResult{how to write algorithm with \LaTeX2e }
 initialize $list$ as an empty  list of integers. \\
%\While{not at end of this document}{
%read current\;
$list$ = Get stop Order from behaviour; \\
\eIf{$list size > 0$}{
  find the last stop name in the behaviour table of this mac;\\
   find the $stop\_id$ of the current location; \\
  find all possible avialable next stops of this
                 $stop\_id$;                  
      calculate the distance to all after next;\\   
  insert the result into after next;    \\  
  String $stopAfterNext$ = check  $stop\_name$ with $stop\_distance < 150$ in after next table; \\
  \eIf{$stopAfterNext$ is not empty}{%\\
  String $stopBetween$ = find the name in the stops table;
  }

}{%
  find the closet stop of the producer current location; \\
  insert it into next table; \\
  find initializer; \\
  \eIf{initializer is available}{
     get the initializer stop name;  \\
     restore all stop name for this mac to the behaviour table;
  }

}
\caption{Detection algorithm.}
\end{algorithm}

\end{document}