September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
15
Task/Test-a-function/Kotlin/test-a-function.kotlin
Normal file
15
Task/Test-a-function/Kotlin/test-a-function.kotlin
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// version 1.1.3
|
||||
|
||||
fun isPalindrome(s: String) = (s == s.reversed())
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val testCases = listOf("racecar", "alice", "eertree", "david")
|
||||
for (testCase in testCases) {
|
||||
try {
|
||||
assert(isPalindrome(testCase)) { "$testCase is not a palindrome" }
|
||||
}
|
||||
catch (ae: AssertionError) {
|
||||
println(ae.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue