From 899156c0f4ac65ad3b11db363c3fd00bca7fecd3 Mon Sep 17 00:00:00 2001 From: alejandrapedroza <39709865+AlejandraPedroza@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:02:48 +0200 Subject: [PATCH] chore: adding `is` in a branch Co-authored-by: Alejandro Serrano --- docs/topics/control-flow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/control-flow.md b/docs/topics/control-flow.md index 20598f509cc..6050aab1993 100644 --- a/docs/topics/control-flow.md +++ b/docs/topics/control-flow.md @@ -199,7 +199,7 @@ sealed interface Animal { fun feedAnimal(animal: Animal) { when (animal) { // Branch with only primary condition. Returns `feedDog()` when `Animal` is `Dog` - Animal.Dog -> feedDog() + is Animal.Dog -> feedDog() // Branch with both primary and guard conditions. Returns `feedCat()` when `Animal` is `Cat` and is not `mouseHunter` is Animal.Cat if !animal.mouseHunter -> feedCat() // Returns "Unknown animal" if none of the above conditions match