Sebastien Hertz | 1d7702b | 2017-08-18 09:07:27 +0200 | [diff] [blame] | 1 | // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | class KotlinApp { |
Sebastien Hertz | a4af69c | 2017-08-24 18:11:49 +0200 | [diff] [blame] | 6 | |
| 7 | fun ifElse(cond: Boolean) { |
| 8 | val a = 10 |
| 9 | if (cond) { |
| 10 | val b = a * 2 |
| 11 | printInt(b) |
| 12 | } else { |
| 13 | val c = a / 2 |
| 14 | print(c) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | fun printInt(i: Int) { |
| 19 | println(i) |
| 20 | } |
| 21 | |
Sebastien Hertz | 1d7702b | 2017-08-18 09:07:27 +0200 | [diff] [blame] | 22 | companion object { |
| 23 | @JvmStatic fun main(args: Array<String>) { |
Sebastien Hertz | 1d7702b | 2017-08-18 09:07:27 +0200 | [diff] [blame] | 24 | val instance = KotlinApp() |
Sebastien Hertz | a4af69c | 2017-08-24 18:11:49 +0200 | [diff] [blame] | 25 | instance.ifElse(true) |
| 26 | instance.ifElse(false) |
Sebastien Hertz | 1d7702b | 2017-08-18 09:07:27 +0200 | [diff] [blame] | 27 | } |
| 28 | } |
Sebastien Hertz | 1d7702b | 2017-08-18 09:07:27 +0200 | [diff] [blame] | 29 | } |