# Kotlin Conditionals: When and If

DevFeed: [Kotlin Conditionals: When and If](<https://devfeed.tech/articles/kotlin-conditionals-when-and-if-25050.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-conditionals/>)

Author: author@typealias.com (Dave Leeds)

Published: 2020-05-05T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [conditionals](<https://devfeed.tech/tags/conditionals.md>), [if-expression](<https://devfeed.tech/tags/if-expression.md>), [if-statement](<https://devfeed.tech/tags/if-statement.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [when-expression](<https://devfeed.tech/tags/when-expression.md>), [writing-code](<https://devfeed.tech/tags/writing-code.md>)

## AI overview

A beginner-oriented chapter explaining Kotlin conditionals through branches, execution paths, and a Goldilocks porridge temperature example.

## Source excerpt

In real life, we do different things depending on the circumstances. For example, if it's raining outside, you'll probably grab an umbrella. If it's sunny outside, you might grab your sunglasses. We do different things depending on the weather. Similarly, we often need our code to do different things in different situations, so in this chapter, we'll look at Kotlin's conditionals. Goldilocks and the Three Branches You might have heard the fairy tale of Goldilocks and the Three Bears.