Week 2 Tutorial

This week in the tutorial, we’ll be looking at decisions in programming.

Statements of truth

Decisions are made based on whether a statement is true. There are a handful of operators that we can use to make statements about whether something is true in C. These are relational operators and equality operators.

Discuss what these operators are and what expressions you can construct with them.

Discuss how you can join these expressions together using the logical operators.

Making decisions based on truth

if blocks allow us to make decisisons in code based on whether a statement is true.

if blocks can have many branches.

Run through the weekdays activity during the tutorial and discuss how to deal with multiple branches in an ifelse ifelse block. Also discuss how to style the code for this exercise and look at the relevant parts of the style guide.

Leap Year

Complete the first part of the leap year activity in the tutorial before heading to the lab, and discuss how you might draw the control flow for determining whether a year is a leap year.