Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Max function should return the largest Int instead of the smallest #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down