Skip to content
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
10 changes: 5 additions & 5 deletions src/functions/Functions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fun helloWorld() {
// 1 parameter, no return value
fun printWithSpaces(text: String) {
for (char in text) {
print(char + " ")
print("$char ")
}
println()
}
Expand All @@ -23,10 +23,10 @@ fun getCurrentDate(): Date {

// 2 parameters, returns Int
fun max(a: Int, b: Int): Int {
if (a >= b) {
return a
return if (a >= b) {
a
} else {
return b
b
}
}

Expand All @@ -35,4 +35,4 @@ fun main(args: Array<String>) {
printWithSpaces("Kotlin is awesome!")
println(getCurrentDate())
println(max(17, 42))
}
}