Skip to content
Closed
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
23 changes: 22 additions & 1 deletion exercises/practice/bob/src/main/kotlin/Bob.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
object Bob {
fun hey(input: String): String {
TODO("Implement the function to complete the task")
//TODO("Implement the function to complete the task")

var response = ""

if (input.last() == '?'){
response = "Sure."
}
else {
for (elt in input){
if (elt.isUpperCase()) {
response = "Whoa, chill out!"
} else if(elt.isUpperCase() && input.last() == '?'){
response = "Calm down, I know what I'm doing!"
} else if (input.isEmpty() || input.isBlank()) {
response = "Fine. Be that way!"
} else {
response = "Whatever"
}
}

}
return response
}
}