Funception

There is no practical limit in how deep your local functions can nest. A function can have a local function, which has its own local function, and so on:

fun up() {
  fun you() {
    fun give() {
      fun gonna() {
        fun never() {

        }
      }
    }
  }
}

However, scoping rules apply. up() cannot call never(), as never() is defined local to gonna() — only gonna() can call never().


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.