From 438b3ed6c2b8bbc2015f896ac3d388ba88ca76f4 Mon Sep 17 00:00:00 2001 From: Sander Ploegsma Date: Thu, 5 Oct 2023 09:04:53 +0200 Subject: [PATCH] Simplify concept about if-statements (#2508) * Deprecate concept exercise `blackjack` * Rename concept to `if-else-statements` * Remove `if` statements from `numbers` concept * Remove introduction.md.tpl from `blackjack` * Add if-else-statements concept to cars-assemble --- concepts/conditionals-if/.meta/config.json | 7 -- concepts/conditionals-if/about.md | 69 ------------- concepts/conditionals-if/introduction.md | 50 ---------- concepts/conditionals-if/links.json | 26 ----- concepts/if-else-statements/.meta/config.json | 5 + concepts/if-else-statements/about.md | 62 ++++++++++++ concepts/if-else-statements/introduction.md | 60 ++++++++++++ concepts/if-else-statements/links.json | 10 ++ concepts/numbers/.meta/config.json | 6 +- concepts/numbers/about.md | 14 --- concepts/numbers/introduction.md | 16 ---- config.json | 96 +++++++++---------- .../blackjack/.docs/introduction.md.tpl | 3 - .../cars-assemble/.docs/introduction.md | 65 +++++++++++-- .../cars-assemble/.docs/introduction.md.tpl | 2 + .../concept/cars-assemble/.meta/design.md | 3 +- 16 files changed, 242 insertions(+), 252 deletions(-) delete mode 100644 concepts/conditionals-if/.meta/config.json delete mode 100644 concepts/conditionals-if/about.md delete mode 100644 concepts/conditionals-if/introduction.md delete mode 100644 concepts/conditionals-if/links.json create mode 100644 concepts/if-else-statements/.meta/config.json create mode 100644 concepts/if-else-statements/about.md create mode 100644 concepts/if-else-statements/introduction.md create mode 100644 concepts/if-else-statements/links.json delete mode 100644 exercises/concept/blackjack/.docs/introduction.md.tpl diff --git a/concepts/conditionals-if/.meta/config.json b/concepts/conditionals-if/.meta/config.json deleted file mode 100644 index fd0cc4d7a..000000000 --- a/concepts/conditionals-if/.meta/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "blurb": "Java supports various logical operations and conditionals like the if statement.", - "authors": [ - "TalesDias" - ], - "contributors": [] -} diff --git a/concepts/conditionals-if/about.md b/concepts/conditionals-if/about.md deleted file mode 100644 index e67f6e3dc..000000000 --- a/concepts/conditionals-if/about.md +++ /dev/null @@ -1,69 +0,0 @@ -# About - -## Logical Operators - -Java supports three [logical operators][logical-operators] `&&` (AND), `||` (OR), and `!` (NOT). - -## If statement - -The underlying type of any conditional operation is the `boolean` type, which can have the value of `true` or `false`. Conditionals are often used as flow control mechanisms to check for various conditions. For checking a particular case an [`if` statement][if-statement] can be used, which executes its code if the underlying condition is `true` like this: - -```java -int val; - -if(val == 9) { - // conditional code -} -``` - -In scenarios involving more than one case many `if` statements can be chained together using the `else if` and `else` statements. - -```java -if(val == 10) { - // conditional code -} else if(val == 17) { - // conditional code -} else { - // executes when val is different from 10 and 17 -} -``` - -## Switch statement - -Java also provides a [`switch` statement][switch-statement] for scenarios with multiple options. It can be used to switch on a variable's content as a replacement for simple `if ... else if` statements. A switch statement can have a `default` case which is executed if no other case applies. - -In Java you can't use any type as the value in a `switch`, only integer and enumerated data types, plus the `String` class are allowed. - -If there are three or more cases in a single `if` (e.g. `if ... else if ... else`), it should be replaced by a `switch` statement. A `switch` with a single case should be replaced by an `if` statement. - -```java -int val; - -// switch statement on variable content -switch(val) { - case 1: - // conditional code - break; - case 2: case 3: case 4: - // conditional code - break; - default: - // if all cases fail - break; -} -``` - - Note: Make sure the expression in the switch statement is not null, otherwise a NullPointerException will be thrown - -To learn more about this topic it is recommended to check these sources: - -- [A refresh of Ternary operators][example-ternary] -- [If/Else detailed with flowcharts][example-ifelse-flowcharts] -- [Switch examples][example-switch] - -[logical-operators]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html -[if-statement]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html -[switch-statement]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html -[example-ifelse-flowcharts]: https://www.javatpoint.com/java-if-else -[example-ternary]: https://www.programiz.com/java-programming/ternary-operator -[example-switch]: https://www.geeksforgeeks.org/switch-statement-in-java/ diff --git a/concepts/conditionals-if/introduction.md b/concepts/conditionals-if/introduction.md deleted file mode 100644 index 3011f35f8..000000000 --- a/concepts/conditionals-if/introduction.md +++ /dev/null @@ -1,50 +0,0 @@ -# Introduction - -## Logical Operators - -Java supports the three logical operators `&&` (AND), `||` (OR), and `!` (NOT). - -## If statement - -The underlying type of any conditional operation is the `boolean` type, which can have the value of `true` or `false`. Conditionals are often used as flow control mechanisms to check for various conditions. For checking a particular case an `if` statement can be used, which executes its code if the underlying condition is `true` like this: - -```java -int val; - -if(val == 9) { - // conditional code -} -``` - -In scenarios involving more than one case many `if` statements can be chained together using the `else if` and `else` statements. - -```java -if(val == 10) { - // conditional code -} else if(val == 17) { - // conditional code -} else { - // executes when val is different from 10 and 17 -} -``` - -## Switch statement - -Java also provides a `switch` statement for scenarios with multiple options. - -```java -int val; - -// switch statement on variable content -switch(val) { - case 1: - // conditional code - break; - case 2: case 3: case 4: - // conditional code - break; - default: - // if all cases fail - break; -} -``` diff --git a/concepts/conditionals-if/links.json b/concepts/conditionals-if/links.json deleted file mode 100644 index 0ba39adb6..000000000 --- a/concepts/conditionals-if/links.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "url": "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html", - "description": "logical-operators" - }, - { - "url": "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html", - "description": "if-statement" - }, - { - "url": "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html", - "description": "switch-statement" - }, - { - "url": "https://www.programiz.com/java-programming/ternary-operator", - "description": "example-ternary" - }, - { - "url": "https://www.javatpoint.com/java-if-else", - "description": "example-ifelse-flowcharts" - }, - { - "url": "https://www.geeksforgeeks.org/switch-statement-in-java/", - "description": "example-switch" - } -] diff --git a/concepts/if-else-statements/.meta/config.json b/concepts/if-else-statements/.meta/config.json new file mode 100644 index 000000000..5ab956b98 --- /dev/null +++ b/concepts/if-else-statements/.meta/config.json @@ -0,0 +1,5 @@ +{ + "blurb": "If-else statements can be used to perform conditional logic.", + "authors": ["TalesDias", "sanderploegsma"], + "contributors": [] +} diff --git a/concepts/if-else-statements/about.md b/concepts/if-else-statements/about.md new file mode 100644 index 000000000..ab9a63ed6 --- /dev/null +++ b/concepts/if-else-statements/about.md @@ -0,0 +1,62 @@ +# About + +## The _if-then_ statement + +The most basic control flow statement in Java is the [_if-then_ statement][if-statement]. +This statement is used to only execute a section of code if a particular condition is `true`. +An _if-then_ statement is defined using the `if` clause: + +```java +class Car { + void drive() { + // the "if" clause: the car needs to have fuel left to drive + if (fuel > 0) { + // the "then" clause: the car drives, consuming fuel + fuel--; + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will do nothing. + +## The _if-then-else_ statement + +The _if-then-else_ statement provides an alternative path of execution for when the condition in the `if` clause evaluates to `false`. +This alternative path of execution follows an `if` clause and is defined using the `else` clause: + +```java +class Car { + void drive() { + if (fuel > 0) { + fuel--; + } else { + stop(); + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will call another method to stop the car. + +The _if-then-else_ statement also supports multiple conditions by using the `else if` clause: + +```java +class Car { + void drive() { + if (fuel > 5) { + fuel--; + } else if (fuel > 0) { + turnOnFuelLight(); + fuel--; + } else { + stop(); + } + } +} +``` + +In the above example, driving the car when the fuel is less then or equal to `5` will drive the car, but it will turn on the fuel light. +When the fuel reaches `0`, the car will stop driving. + +[if-statement]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html diff --git a/concepts/if-else-statements/introduction.md b/concepts/if-else-statements/introduction.md new file mode 100644 index 000000000..4e6d3dc32 --- /dev/null +++ b/concepts/if-else-statements/introduction.md @@ -0,0 +1,60 @@ +# Introduction + +## The _if-then_ statement + +The most basic control flow statement in Java is the _if-then_ statement. +This statement is used to only execute a section of code if a particular condition is `true`. +An _if-then_ statement is defined using the `if` clause: + +```java +class Car { + void drive() { + // the "if" clause: the car needs to have fuel left to drive + if (fuel > 0) { + // the "then" clause: the car drives, consuming fuel + fuel--; + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will do nothing. + +## The _if-then-else_ statement + +The _if-then-else_ statement provides an alternative path of execution for when the condition in the `if` clause evaluates to `false`. +This alternative path of execution follows an `if` clause and is defined using the `else` clause: + +```java +class Car { + void drive() { + if (fuel > 0) { + fuel--; + } else { + stop(); + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will call another method to stop the car. + +The _if-then-else_ statement also supports multiple conditions by using the `else if` clause: + +```java +class Car { + void drive() { + if (fuel > 5) { + fuel--; + } else if (fuel > 0) { + turnOnFuelLight(); + fuel--; + } else { + stop(); + } + } +} +``` + +In the above example, driving the car when the fuel is less then or equal to `5` will drive the car, but it will turn on the fuel light. +When the fuel reaches `0`, the car will stop driving. diff --git a/concepts/if-else-statements/links.json b/concepts/if-else-statements/links.json new file mode 100644 index 000000000..0f138a23f --- /dev/null +++ b/concepts/if-else-statements/links.json @@ -0,0 +1,10 @@ +[ + { + "url": "https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html", + "description": "Java tutorial on if-then-else statements" + }, + { + "url": "https://www.javatpoint.com/java-if-else", + "description": "Example if-then-else statements with flow charts" + } +] diff --git a/concepts/numbers/.meta/config.json b/concepts/numbers/.meta/config.json index fdffc23f4..506871c4f 100644 --- a/concepts/numbers/.meta/config.json +++ b/concepts/numbers/.meta/config.json @@ -1,7 +1,5 @@ { "blurb": "Java includes various numeric types including integer and floating-point numbers.", - "authors": [ - "TalesDias" - ], - "contributors": [] + "authors": ["TalesDias"], + "contributors": ["sanderploegsma"] } diff --git a/concepts/numbers/about.md b/concepts/numbers/about.md index 3ef210de8..53e057db4 100644 --- a/concepts/numbers/about.md +++ b/concepts/numbers/about.md @@ -62,20 +62,6 @@ double fromInt = i; int fromDouble = (int)d; ``` -An `if` statement can be used to conditionally execute code. The condition of an `if` statement must be of type `boolean`. Java has no concept of _truthy_ values. - -```java -int x = 6; - -if (x == 5){ - // Execute logic if x equals 5 -} else if (x > 7){ - // Execute logic if x greater than 7 -} else{ - // Execute logic in all other cases -} -``` - [arithmetic-operators]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html [comparison-operators]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html [type-casting]: https://www.programiz.com/java-programming/typecasting diff --git a/concepts/numbers/introduction.md b/concepts/numbers/introduction.md index d68887ddb..352a45eb5 100644 --- a/concepts/numbers/introduction.md +++ b/concepts/numbers/introduction.md @@ -15,19 +15,3 @@ Java has two types of numeric conversions: 2. Explicit conversions: data could be lost and additional syntax in the form of a _cast_ is required. As an `int` has less precision than a `double`, converting from an `int` to a `double` is safe and is thus an implicit conversion. However, converting from a `double` to an `int` could mean losing data, so that requires an explicit conversion. - -In this exercise you must conditionally execute logic. The most common way to do this in Java is by using an `if/else` statement: - -```java -int x = 6; - -if (x == 5) { - // Execute logic if x equals 5 -} else if (x > 7) { - // Execute logic if x greater than 7 -} else { - // Execute logic in all other cases -} -``` - -The condition of an `if` statement must be of type `boolean`. diff --git a/config.json b/config.json index b655cabf1..23829da5b 100644 --- a/config.json +++ b/config.json @@ -66,7 +66,7 @@ "foreach-loops" ], "prerequisites": [ - "conditionals-if" + "if-else-statements" ], "status": "active" }, @@ -93,7 +93,7 @@ "exceptions" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "switch-statement" ], "status": "beta" @@ -118,7 +118,7 @@ "classes" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "numbers", "strings" ], @@ -128,13 +128,9 @@ "slug": "blackjack", "name": "Play Your Cards!", "uuid": "43b8f2e3-99e9-49cc-a897-d66f0f26670d", - "concepts": [ - "conditionals-if" - ], - "prerequisites": [ - "booleans" - ], - "status": "active" + "concepts": [], + "prerequisites": [], + "status": "deprecated" }, { "slug": "need-for-speed", @@ -166,12 +162,8 @@ "slug": "cars-assemble", "name": "Cars, Assemble!", "uuid": "3f451c6b-04e2-4b08-8bb0-7dcd2ec5b8f4", - "concepts": [ - "numbers" - ], - "prerequisites": [ - "conditionals-if" - ], + "concepts": ["if-else-statements", "numbers"], + "prerequisites": ["booleans"], "status": "active" }, { @@ -194,7 +186,7 @@ "ternary-operators" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "numbers" ], "status": "active" @@ -250,7 +242,7 @@ "uuid": "74515d45-565b-4be2-96c4-77e58efa9257", "practices": [ "strings", - "conditionals-if" + "if-else-statements" ], "prerequisites": [ "basics" @@ -348,7 +340,7 @@ ], "prerequisites": [ "numbers", - "conditionals-if" + "if-else-statements" ], "difficulty": 4 }, @@ -361,7 +353,7 @@ ], "prerequisites": [ "strings", - "conditionals-if", + "if-else-statements", "for-loops" ], "difficulty": 4 @@ -388,7 +380,7 @@ "lists" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "for-loops", "classes" ], @@ -429,7 +421,7 @@ "lists" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "classes" ], "difficulty": 6 @@ -470,12 +462,12 @@ "name": "Raindrops", "uuid": "d916e4f8-fda1-41c0-ab24-79e8fc3f1272", "practices": [ - "conditionals-if", + "if-else-statements", "numbers", "strings" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "numbers", "strings" ], @@ -486,12 +478,12 @@ "name": "Isogram", "uuid": "c3e89c7c-3a8a-4ddc-b653-9b0ff9e1d7d8", "practices": [ - "conditionals-if", + "if-else-statements", "for-loops", "strings" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "for-loops", "strings" ], @@ -519,13 +511,13 @@ "uuid": "fb10dc2f-0ba1-44b6-8365-5e48e86d1283", "practices": [ "arrays", - "conditionals-if", + "if-else-statements", "lists", "for-loops" ], "prerequisites": [ "arrays", - "conditionals-if", + "if-else-statements", "lists", "for-loops" ], @@ -549,7 +541,7 @@ "name": "Darts", "uuid": "4d400a44-b190-4a0c-affb-99fad8ea18da", "practices": [ - "conditionals-if", + "if-else-statements", "constructors" ], "prerequisites": [ @@ -579,7 +571,7 @@ "numbers" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "for-loops" ], "difficulty": 2 @@ -678,7 +670,7 @@ "name": "Bob", "uuid": "34cd328c-cd96-492b-abd4-2b8716cdcd9a", "practices": [ - "conditionals-if" + "if-else-statements" ], "prerequisites": [ "strings", @@ -783,7 +775,7 @@ "lists" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "classes" ], "difficulty": 5 @@ -796,7 +788,7 @@ "strings" ], "prerequisites": [ - "conditionals-if", + "if-else-statements", "for-loops", "classes" ], @@ -811,7 +803,7 @@ ], "prerequisites": [ "chars", - "conditionals-if", + "if-else-statements", "classes" ], "difficulty": 5 @@ -924,7 +916,7 @@ "topics": [ "arrays", "classes", - "conditionals-if", + "if-else-statements", "games", "matrices" ] @@ -948,7 +940,7 @@ "name": "Go Counting", "uuid": "2e760ae2-fadd-4d31-9639-c4554e2826e9", "practices": [ - "conditionals-if", + "if-else-statements", "for-loops", "enums" ], @@ -965,7 +957,7 @@ "prerequisites": [], "difficulty": 7, "topics": [ - "conditionals-if", + "if-else-statements", "pattern_matching", "refactoring", "strings" @@ -1050,7 +1042,7 @@ "difficulty": 4, "topics": [ "arrays", - "conditionals-if", + "if-else-statements", "integers", "loops", "math" @@ -1065,7 +1057,7 @@ "difficulty": 4, "topics": [ "bitwise_operations", - "conditionals-if", + "if-else-statements", "exception_handling", "lists", "loops", @@ -1080,7 +1072,7 @@ "prerequisites": [], "difficulty": 6, "topics": [ - "conditionals-if", + "if-else-statements", "logic" ] }, @@ -1218,7 +1210,7 @@ "prerequisites": [], "difficulty": 4, "topics": [ - "conditionals-if", + "if-else-statements", "exception_handling", "integers", "math", @@ -1262,7 +1254,7 @@ "difficulty": 5, "topics": [ "arrays", - "conditionals-if", + "if-else-statements", "integers", "lists", "loops", @@ -1278,7 +1270,7 @@ "difficulty": 7, "topics": [ "algorithms", - "conditionals-if", + "if-else-statements", "loops" ] }, @@ -1370,7 +1362,7 @@ "prerequisites": [], "difficulty": 6, "topics": [ - "conditionals-if", + "if-else-statements", "loops", "strings" ] @@ -1414,7 +1406,7 @@ "difficulty": 6, "topics": [ "arrays", - "conditionals-if", + "if-else-statements", "exception_handling", "integers", "loops", @@ -1456,7 +1448,7 @@ "prerequisites": [], "difficulty": 8, "topics": [ - "conditionals-if", + "if-else-statements", "integers", "lists", "loops", @@ -1525,7 +1517,7 @@ "prerequisites": [], "difficulty": 6, "topics": [ - "conditionals-if", + "if-else-statements", "lists", "maps", "sorting", @@ -1896,7 +1888,7 @@ "prerequisites": [], "difficulty": 3, "topics": [ - "conditionals-if", + "if-else-statements", "floating_point_numbers" ] }, @@ -1921,7 +1913,7 @@ "prerequisites": [ "strings", "chars", - "conditionals-if", + "if-else-statements", "lists", "for-loops" ], @@ -1934,7 +1926,7 @@ "practices": [], "prerequisites": [ "strings", - "conditionals-if", + "if-else-statements", "lists", "for-loops" ], @@ -1995,8 +1987,8 @@ }, { "uuid": "4ce7cdbb-4ff3-4988-89db-8fbcef380500", - "slug": "conditionals-if", - "name": "Conditionals If" + "slug": "if-else-statements", + "name": "If-Else Statements" }, { "uuid": "e552c05c-6360-4b2f-a438-7ec7e855c0f5", diff --git a/exercises/concept/blackjack/.docs/introduction.md.tpl b/exercises/concept/blackjack/.docs/introduction.md.tpl deleted file mode 100644 index bca061f4c..000000000 --- a/exercises/concept/blackjack/.docs/introduction.md.tpl +++ /dev/null @@ -1,3 +0,0 @@ -# Introduction - -%{concept:conditionals-if} diff --git a/exercises/concept/cars-assemble/.docs/introduction.md b/exercises/concept/cars-assemble/.docs/introduction.md index c05cfe01f..50fc496e1 100644 --- a/exercises/concept/cars-assemble/.docs/introduction.md +++ b/exercises/concept/cars-assemble/.docs/introduction.md @@ -18,18 +18,63 @@ Java has two types of numeric conversions: As an `int` has less precision than a `double`, converting from an `int` to a `double` is safe and is thus an implicit conversion. However, converting from a `double` to an `int` could mean losing data, so that requires an explicit conversion. -In this exercise you must conditionally execute logic. The most common way to do this in Java is by using an `if/else` statement: +## If-Else Statements + +### The _if-then_ statement + +The most basic control flow statement in Java is the _if-then_ statement. +This statement is used to only execute a section of code if a particular condition is `true`. +An _if-then_ statement is defined using the `if` clause: + +```java +class Car { + void drive() { + // the "if" clause: the car needs to have fuel left to drive + if (fuel > 0) { + // the "then" clause: the car drives, consuming fuel + fuel--; + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will do nothing. + +### The _if-then-else_ statement + +The _if-then-else_ statement provides an alternative path of execution for when the condition in the `if` clause evaluates to `false`. +This alternative path of execution follows an `if` clause and is defined using the `else` clause: + +```java +class Car { + void drive() { + if (fuel > 0) { + fuel--; + } else { + stop(); + } + } +} +``` + +In the above example, if the car is out of fuel, calling the `Car.drive` method will call another method to stop the car. + +The _if-then-else_ statement also supports multiple conditions by using the `else if` clause: ```java -int x = 6; - -if (x == 5) { - // Execute logic if x equals 5 -} else if (x > 7) { - // Execute logic if x greater than 7 -} else { - // Execute logic in all other cases +class Car { + void drive() { + if (fuel > 5) { + fuel--; + } else if (fuel > 0) { + turnOnFuelLight(); + fuel--; + } else { + stop(); + } + } } ``` -The condition of an `if` statement must be of type `boolean`. +In the above example, driving the car when the fuel is less then or equal to `5` will drive the car, but it will turn on the fuel light. +When the fuel reaches `0`, the car will stop driving. diff --git a/exercises/concept/cars-assemble/.docs/introduction.md.tpl b/exercises/concept/cars-assemble/.docs/introduction.md.tpl index ce74d2829..0c29a1a96 100644 --- a/exercises/concept/cars-assemble/.docs/introduction.md.tpl +++ b/exercises/concept/cars-assemble/.docs/introduction.md.tpl @@ -1,3 +1,5 @@ # Introduction %{concept:numbers} + +%{concept:if-else-statements} diff --git a/exercises/concept/cars-assemble/.meta/design.md b/exercises/concept/cars-assemble/.meta/design.md index 5c1c20972..8d54df485 100644 --- a/exercises/concept/cars-assemble/.meta/design.md +++ b/exercises/concept/cars-assemble/.meta/design.md @@ -17,10 +17,11 @@ ## Concepts - `numbers`: know of the existence of the two most commonly used number types, `int` and `double`; understand that the former represents whole numbers, and the latter floating-point numbers; know of basic operators such as multiplication, comparison and equality; know how to convert from one numeric type to another; know what implicit and explicit conversions are. -- `conditionals`: know how to conditionally execute code using an `if` statement. +- `if-else-statements`: know how to conditionally execute code using an `if` statement. ## Prerequisites This exercise's prerequisites Concepts are: - `basics`: know how to define methods. +- `booleans`: know how to use boolean operators.