Find limit of recursion is part of Short Circuit's Console Program Basics selection.
Task

Find the limit of recursion.




 
Module checkit {
      Global z
      Function a {
            z++
            =a()
      }
      try {
            m=a()
      }
      Print z
 
      z<=0
      Function a {
            z++
            call a()
      }
      try {
            call a()
      }
      Print z
 
      z<=0
      Module m {
            z++
            Call m
      }
      try {
            call m
      }
      Print z
 
      z<=0
      \\ without Call a module can't call itself
      \\ but can call something global, and that global can call back
      Module Global m1 {
            z++
            m2
      }
      Module Global m2 {
            z++
            m1
      }
      try {
            call m1
      }
      Print z
}
Checkit
 