Conditions or Control Flow in Carbon Language – If, elseif, else

conditions in carbon language - if elseif else

Conditions or control flow in carbon language is similar to any other language. It has if, elseif and else keywords.

Introduction

if and else provide conditional execution of statements. An if statement consists of:

Code Example

if (5 > 6) {
  Console.Print("5 is greater than 6");
} else if (5 == 6) {
  Console.Print("5 is equals to 6");
} else {
  Console.Print("5 is less than 6");
}