In real life, we do different things depending on the circumstances. For example, if it’s raining outside, I’ll probably grab an umbrella. If it’s sunny outside, I’ll grab my sunglasses. I do different things depending on the weather. By Dave Leeds.
In this chapter, you will learn all about conditionals in Kotlin, which will allow us to change the way the code runs depending on circumstances! This is chapter 3 of animated tutorial series helping you to learn Kotlin programming language.
We can write Kotlin code that will tell us which of these three things Goldilocks will say, based on the temperature of the porridge. In programming terms, the three different cases above – that is, the three different rows of the table – are called branches. If it helps, you can visualize the branches like you’d see on a tree …
It is an excellent educational material for young learners or beginners to coding with great illustrations and excellent code explanations teaching the basics of programming. The chapter teaches conditionals around the fairy tale of Goldilocks and the Three Bears with mappings, code examples and visualisations. Recommended![Read More]