Skip to content

Instantly share code, notes, and snippets.

@Dobiasd
Created June 17, 2021 20:10
Show Gist options
  • Save Dobiasd/6f7324630f4e589ef8f6c5dccf9b31d1 to your computer and use it in GitHub Desktop.
Save Dobiasd/6f7324630f4e589ef8f6c5dccf9b31d1 to your computer and use it in GitHub Desktop.
fun foo() {
    var x = 21
    bar()
    println(2 * x)
}

fun bar() {
    // imagine something very long nobody wants to read
}

fun main() {
    foo()
}
var x = 21

fun foo() {
    bar()
    println(2 * x)
}

fun bar() {
    // imagine something very long nobody wants to read
}

fun main() {
    foo()
}
fun foo() {
    var x = 21
    fun bar() {
        x = 1
    }
    bar()
    println(2 * x)
}


fun main() {
    foo()
}
class Thing {
    var x = 21

    fun foo() {
        bar()
        println(2 * x)
    }

    fun bar() {
        x = 1
    }
}

fun main() {
    val myThing = Thing()
    myThing.foo()
}
class Thing {
    var x = 21
    var y = 2

    fun foo() {
        bar()
        println(y * x)
    }

    fun bar() {
        println(y)
    }
}

fun main() {
    val myThing = Thing()
    myThing.foo()
}
class Thing {
    var x = 21
    var y = 2

    fun foo() {
        bar(y)
        println(y * x)
    }
}

fun bar(y: Int) {
    println(y)
}

fun main() {
    val myThing = Thing()
    myThing.foo()
}
class Thing {
    var x = 21
    var y = 2

    fun foo() {
        bar(y)
        println(y * x)
    }

    companion object {
        fun bar(y: Int) {
            println(y)
        }
    }
}

fun main() {
    val myThing = Thing()
    myThing.foo()
}
class Thing {
    var x = 21
    var y = 2
    var z = 3
}

fun foo(x: Int, y: Int) {
    bar(y)
    println(y * x)
}

fun bar(y: Int) {
    println(y)
}

fun main() {
    val myThing = Thing()
    foo(myThing.x, myThing.y)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment