3.2 - Types of Control Flow Statements
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does the if statement do?
💡 Hint: Think of it as a yes/no question.
What will the following code print? int i = 2; if (i > 1) { System.out.println('Greater'); }
💡 Hint: Is 2 greater than 1?
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What is the purpose of a conditional statement?
💡 Hint: Consider when you need to perform different actions based on conditions.
True or False: A while loop executes its code block at least once.
💡 Hint: Think about when the loop's condition is evaluated.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a function that takes an integer and uses a loop to return the factorial of that number.
💡 Hint: What do you multiply together to get a factorial?
Using a switch statement, create a program that outputs a user's rating for a movie based on their input: 1 for bad, 2 for average, 3 for good, and 4 for excellent.
💡 Hint: How can you match each rating to a specific message?
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.