Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // don't
- val a = 10
- val b = 19
- val c = 22
- if (a > b) {
- println(a)
- } else {
- println(b)
- }
- // code repeated
- if (b > c) {
- print(b)
- } else {
- println(c)
- }
- // do
- // create a function
- fun bigger(a: Int, b: Int) {
- if (a > b) {
- println(a)
- } else {
- println(b)
- }
- }
- val d = 10
- val e = 19
- val f = 22
- // no code repeated
- bigger(d, e) // 19
- bigger(e, f) // 22
Add Comment
Please, Sign In to add comment