3 Control flow
This chapter covers
- Using Boolean values in conditions
- Running the same code multiple times using while and for loops
- Deciding what code to run with an if statement
- Looping over ranges of numbers
- Defining functions spanning multiple lines of code
- Implementing control flow using recursion or iteration
Control flow is what separates a computer from a mere calculator. Calculators are for computing single expressions. Computers, on the other hand, have the ability to repeat the same calculations with different inputs numerous times without human intervention. Computers can choose to perform one calculation over another based on whether or not a condition holds true.
In this chapter you will explore code examples oriented around producing ...
Get Julia as a Second Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.