Last active
April 1, 2018 18:52
-
-
Save jdsingh/2796261bd52bba936f9c02c8e3c188a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun outerFunction(nice: String) { | |
val hello = "Hello, world" | |
fun innerFunction(awesome: String) { | |
println(awesome) | |
// we can access arguments of outer function | |
println(nice) | |
// and we can also access variables declared in outer functions | |
println(hello) | |
} | |
// invoking inner function | |
innerFunction("This is awesome") | |
} | |
fun main(args: Array<String>) { | |
// we can access outerFunction but not innerFunction outside of the | |
// outerFunction's scope | |
outerFunction("This is nice") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment