Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Demo of nested if -else and compound condtions.
- Try changing the temperature to different numbers and sunny to false to see the message change
- */
- fun main(args:Array<String>) {
- val temperature = 65
- val sunny = false
- if (temperature >= 65 && temperature < 75)
- {
- if (sunny)
- {
- println("Go for a run!")
- }
- else
- {
- println("OK to run, but do not get wet!")
- }
- }
- else
- {
- println("Stay in, perhaps the gym?")
- }
- }
Add Comment
Please, Sign In to add comment