diff --git a/src/content/1.2/types-and-functions.tex b/src/content/1.2/types-and-functions.tex index 788ee0f7..b286b60d 100644 --- a/src/content/1.2/types-and-functions.tex +++ b/src/content/1.2/types-and-functions.tex @@ -24,7 +24,7 @@ \section{Who Needs Types?} remaining programs will have a better chance of being useful. Type checking provides yet another barrier against nonsensical programs. Moreover, whereas in a dynamically typed language, type mismatches would -be discovered at runtime, in strongly typed statically checked languages +be discovered at runtime, in strongly typed statically checked languages, type mismatches are discovered at compile time, eliminating lots of incorrect programs before they have a chance to run. @@ -408,7 +408,7 @@ \section{Examples of Types} to define a Boolean type in C++ as an enumeration: \begin{snip}{cpp} -enum bool { +enum bool { true, false }; @@ -468,7 +468,7 @@ \section{Challenges} \end{minted} \item \begin{minted}{cpp} -bool f() { +bool f() { std::cout << "Hello!" << std::endl; return true; } @@ -490,4 +490,4 @@ \section{Challenges} \code{Void}, \code{()} (unit), and \code{Bool}; with arrows corresponding to all possible functions between these types. Label the arrows with the names of the functions. -\end{enumerate} \ No newline at end of file +\end{enumerate}