Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val i = 10
- // Use paste mode in REPL or IDE
- if(i % 2 == 0)
- print(i + " is even")
- else
- print(i + " is odd")
- if(i == 0) {
- print("Neither even nor odd, it's zero")
- } else if(i%2 == 0) {
- print(i + " is even")
- } else {
- print(i + " is odd")
- }
- // Ternary Operator
- if(i%2 == 0) print(i + " is even") else print(i + " is odd")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement