From fedc0737f281a58984660ca2a693efcd11726950 Mon Sep 17 00:00:00 2001 From: Riccardo Lippolis Date: Wed, 3 Jul 2019 15:57:55 +0200 Subject: [PATCH] Max function should return the largest Int instead of the smallest --- .../kotlinworkshop/introduction/_1Intro/_3Functions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instructor/introduction/org/jetbrains/kotlinworkshop/introduction/_1Intro/_3Functions.kt b/instructor/introduction/org/jetbrains/kotlinworkshop/introduction/_1Intro/_3Functions.kt index 4752994..0e5916b 100644 --- a/instructor/introduction/org/jetbrains/kotlinworkshop/introduction/_1Intro/_3Functions.kt +++ b/instructor/introduction/org/jetbrains/kotlinworkshop/introduction/_1Intro/_3Functions.kt @@ -1,10 +1,10 @@ package org.jetbrains.kotlinworkshop.introduction._1Intro fun max(a: Int, b: Int): Int { - return if (a < b) a else b + return if (a > b) a else b } -fun max2(a: Int, b: Int) = if (a < b) a else b +fun max2(a: Int, b: Int) = if (a > b) a else b // default values for arguments fun sum(a: Int, b: Int, c: Int = 0) = a + b + c