Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
184_notes:if [2022/05/06 22:03] – [Else Clauses] woodsna1 | 184_notes:if [2022/05/07 01:21] (current) – woodsna1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Coding: "If Statements" | ====== Coding: "If Statements" | ||
+ | ==== Lecture Video ==== | ||
+ | |||
+ | {{youtube> | ||
Sometimes, we only want the computer to execute code in specific cases. For instance, only divide if the denominator is nonzero. How can the computer decide if the denominator is nonzero? One way is by using an if statement: | Sometimes, we only want the computer to execute code in specific cases. For instance, only divide if the denominator is nonzero. How can the computer decide if the denominator is nonzero? One way is by using an if statement: | ||
< | < | ||
Line 21: | Line 24: | ||
===== Nesting If Statements ===== | ===== Nesting If Statements ===== | ||
+ | ==== Lecture Video ==== | ||
+ | {{youtube> | ||
Similarly to loops, we can use nested if statements: | Similarly to loops, we can use nested if statements: | ||
< | < |