Android Question Call the same sub inside a sub ?

Discussion in 'Android Questions' started by marcick, Jun 13, 2015.

  1. marcick

    marcick Well-Known Member Licensed User

    Is it doable or can create stack troubles ?
    Something like this:

    Code:
    Sub pippo() 

         bla bla ..
         bla bla...
         
    if .. then pippo

    end sub
     
  2. klaus

    klaus Expert Licensed User

    thedesolatesoul likes this.
  3. marcick

    marcick Well-Known Member Licensed User

    I was a bit confusing because:

    If sub "sub1" call sub "sub2" then sub2 call "sub3", the end of sub3 return to sub2 and the end of sub2 return to sub1. So there is a stack mechanism.

    Now, if "sub1" call itself, does it means that the stack is not updated, right ? And the end of sub1 does not return again to sub1 but to who called sub1 the first time, right ?
     
  4. klaus

    klaus Expert Licensed User

    When Sub1 calls itself it goes also back to itself !
     
    RandomCoder likes this.
  5. marcick

    marcick Well-Known Member Licensed User

    So the behaviour is not like a GoTo.
    I need to look carefully the program flow.
    Thanks Klaus, bye
    Marco
     
  6. klaus

    klaus Expert Licensed User

    NO !
    GoTo doesn't exist in B4A.
     
    Erel, thedesolatesoul and NJDude like this.
  7. LucaMs

    LucaMs Expert Licensed User

    "Never say never"
     
  8. pappicio

    pappicio Active Member Licensed User

    You don't need goto command, is useless.
     
Loading...