Skip to content

12.1. If: Added example of single statement if block#218

Closed
karimdevelops wants to merge 1 commit intoTogether-Java:developfrom
karimdevelops:patch-6
Closed

12.1. If: Added example of single statement if block#218
karimdevelops wants to merge 1 commit intoTogether-Java:developfrom
karimdevelops:patch-6

Conversation

@karimdevelops
Copy link
Contributor

For better readability, I have added example that you do need curly braces always by showing single statement if block.

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
}

@karimdevelops karimdevelops requested review from a team as code owners February 15, 2026 08:07
@bowbahdoe
Copy link
Collaborator

@karimdevelops hey man, I am going to review these, but it will be more productive to make issues for most things, rather than PRs.

Like with this I am very intentionally not mentioning the short form of if. I can go back and address shorthands later but there isn't too much value to doing so

@karimdevelops
Copy link
Contributor Author

@bowbahdoe Sure, i was reading your contribution guidelines too and you mentioned issues there.
I will keep that in mind.

@bowbahdoe
Copy link
Collaborator

bowbahdoe commented Feb 15, 2026

@karimdevelops Other people wrote that - as you can see from the 67 issues and open prs I do have a lot to do. I'll get to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants