mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 16:20:09 +01:00
**### There is issue in conditionals.md readme file**
**In example of fruits conditionals**
**there are fruits.IsGreen() if it is False then continue.
if it is True then print "Apple" but in readme file there is "Orange"**
I replaced "Orange" with "Apple" because in example there is "Apple"
```carbon
if (fruit.IsYellow()) {
Print("Banana!");
} else if (fruit.IsOrange()) {
Print("Orange!");
} else if (fruit.IsGreen()) {
Print("Apple!");
} else {
Print("Vegetable!");
}
fruit.Eat();
```
Control flow
Overview
Blocks of statements are generally executed linearly. However, statements are the primary place where this flow of execution can be controlled.
Carbon's flow control statements are:
ifandelseprovides conditional execution of statements.- Loops:
returnends the flow of execution within a function, returning it to the caller.