Course Content

Course Content

FAQs

If statements are used in Ruby to determine if a statement or a block of statements will be performed or not, i.e. if a condition is true, a block of statements will be executed, otherwise not.

If the conditional is true, the code is executed. The code supplied in the otherwise clause is run if the conditional is not true. The reserved word then, a newline, or a semicolon separates the conditional part of an if statement from the code.

If a particular condition is true, the if/else statement executes a block of code. Another block of code can be performed if the condition is false. The if/else statement is part of Ruby's "Conditional" Statements, which are used to conduct various actions depending on certain situations.

If-then condition. A program determines which statement to execute based on the result of the assessed condition, which is also known as branching.

The if-else condition is used to execute both the true and false parts of a condition. The if block code is run if the condition is true, and the else block code is executed if the condition is false.

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere