in reply to Re^4: return from external subroutine
in thread return from external subroutine

I understood that much but you don't need a return for it and I was just wondering if by adding the return you mess up some internal stacks or pointers and thereby have the main program fail mysteriously.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^6: return from external subroutine
by chromatic (Archbishop) on Aug 24, 2007 at 16:39 UTC

    The same rules as returning from a sub apply. If there's a return, the value there gets returned per the normal rules. If there's no return, the value of the last evaluated expression gets returned. The most correct way to end a module is with an explicit return.

      Thank you for this explanation! Scarcely a day goes by without increasing my knowledge when visiting this site.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James