handouts/scala-ho.tex
changeset 242 35104ee14f87
parent 240 de4f6382590a
child 245 a5fade10c207
equal deleted inserted replaced
241:10f02605a46a 242:35104ee14f87
   362  
   362  
   363 \subsection*{Loops, or the Absence of}
   363 \subsection*{Loops, or the Absence of}
   364 
   364 
   365 Coming from Java or C, you might be surprised that Scala does
   365 Coming from Java or C, you might be surprised that Scala does
   366 not really have loops. It has instead, what is in functional
   366 not really have loops. It has instead, what is in functional
   367 programming called ,\emph{maps}. To illustrate how they work,
   367 programming called, \emph{maps}. To illustrate how they work,
   368 lets assume you have a list of numbers from 1 to 8 and want to
   368 lets assume you have a list of numbers from 1 to 8 and want to
   369 build the list of squares. The list of numbers from 1 to 8 
   369 build the list of squares. The list of numbers from 1 to 8 
   370 can be constructed in Scala as follows:
   370 can be constructed in Scala as follows:
   371 
   371 
   372 \begin{lstlisting}[numbers=none]
   372 \begin{lstlisting}[numbers=none]