blob: 094407bffcd8557bab2e5f87d42d130574ab1065 [file] [log] [blame]
Sebastien Hertz1d7702b2017-08-18 09:07:27 +02001// 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
5class KotlinApp {
Sebastien Hertza4af69c2017-08-24 18:11:49 +02006
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 Hertz1d7702b2017-08-18 09:07:27 +020022 companion object {
23 @JvmStatic fun main(args: Array<String>) {
Sebastien Hertz1d7702b2017-08-18 09:07:27 +020024 val instance = KotlinApp()
Sebastien Hertza4af69c2017-08-24 18:11:49 +020025 instance.ifElse(true)
26 instance.ifElse(false)
Sebastien Hertz1d7702b2017-08-18 09:07:27 +020027 }
28 }
Sebastien Hertz1d7702b2017-08-18 09:07:27 +020029}