haskell-lectures/VL1/content/VL1_case_of.tex

9 lines
449 B
TeX

\ifger{Wir können auch auf dem Ergebnis eines Ausdruckes pattern matchen, nicht nur auf Eingabeargumente. Dafür schreiben wir:}{We can also pattern match on the result of a real expression, not just the input. For that, we write:}
\begin{haskellcode}
f :: Int -> Bool
f x = case x - 2 of
2 -> True
5 -> True
y -> False
\end{haskellcode}
\ifger{Das erlaubt uns etwas mächtigeres pattern matching}{This allows more powerful pattern matching}.