Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/branching_logic/if.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ if (age < 25) {

If this condition evaluates to `false`, then the code inside of `{` and `}`
will not run.

NOTE: If you have only one statement, you do not need to put code inside of `{` and `}`. Moreover, the remaining lines will not be considered part of the if block.

```java
~void main() {
int age = 20;
if (age < 25)
IO.println("You are too young to rent a car!"); // If condition evaluates to true
IO.println("Bye bye"); // Always printed
~}
```