Created
November 12, 2018 07:38
-
-
Save ozcanzaferayan/4c3c7880a0127553627e41018faa45a6 to your computer and use it in GitHub Desktop.
Kotlin Nedir 2: Switch-case yapısı - çoklu durumlar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun tekMiCiftMi(sayi: Int) : String { | |
| return when (sayi % 2) { | |
| 0, 1 -> "Tek veya çifttir" | |
| else -> { | |
| throw IllegalArgumentException() | |
| } | |
| } | |
| } | |
| fun main(args: Array<String>) { | |
| // Çıktısı: Tek veya çifttir | |
| print(tekMiCiftMi(5)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment