course content

Course Content

Introduction to Dart

If statementIf statement

If statement

An if statement is a construct that allows you to execute a code block if a specific condition is met.

The condition is an expression that evaluates to a bool value, which can be true or false. If the condition is true, the block of code is executed. If the condition is false, the block of code is skipped.


The syntax of the conditional operator is so simple: if keyword, condition in the parentheses ( ) and a code block in the curly brackets { }.

The open curly bracket { } opens the code block, and the close curly bracket symbol closes it.

Example 1



The condition was confirmed and the block of code worked.

Example 2



The condition was not confirmed, and the code block did not work.



What should be put instead of "?" so the program works correctly?

Select the correct answer

Everything was clear?

Section 3. Chapter 1