Bob.
This seems right. The return in test2 "returns" to the test1 handler, and the next line in that handler executes, going on to test3. This executes, "returning" to test1 as well, and on up to "mouseUp". In other words, the return in test2 does not know about the fact that the whole thing was started in the mouseUp handler. It would cut off any additional lines of code within itself, but not in test1. Craig on mouseUp put test1() end mouseUp function test1 put "blah" into myVar put test2() into myVar2 put test3() into myVar3 end test1 function test2 return "blah2" end test2 function test3 return "blah3" end test3 -----Original Message----- From: Bob Sneidar <bobsnei...@iotecdigital.com> To: How to use LiveCode <use-livecode@lists.runrev.com> Sent: Fri, Nov 14, 2014 2:36 pm Subject: Re: how are variables passed from functions? Not sure what you are asking, but here is how functions work. As soon as the script execution encounters a return command, the function terminates and returns control to the calling handler. Nothing that comes after the return in the function is executed. Now here is what weirds me out: on mouseUp put test1() end mouseUp function test1 put "blah" into myVar put test2() into myVar2 put test3() into myVar3 end test1 function test2 return "blah2" end test2 function test3 return "blah3" end test3 This produces “blah3”. Really? So… the last value *ANY* function returns becomes the value returned of any function that called it unless specified otherwise. Is this the intended behavior? That is frightening and unnerving. Bob S > On Nov 14, 2014, at 08:20 , Tiemo Hollmann TB <toolb...@kestner.de> wrote: > > Hi Craig, > perhaps I didn't expressed myself correct, I'm not a native speaker. > For me the result seems the same, if I put a return myVar2 at the end of function foo1 or not (see below). The intermediate function is terminated AFTER the call of the second function at the end. > My original script works without a return in foo1. My question was, if it is > a good or bad practice if I would add this return, just for "safety reasons" to be sure anything is returned in case I would change anything, e.g. I would replace the call of function foo2 by any other structure. > Tiemo > > --Btn script > on mouseUp > put foo1() into myVar1 > end mouseUp > > --script in stack > function foo1 > put foo2() into myVar2 > return myVar2 -- return statement yes or no? > end foo1 > > function foo2 > return "Test" > end foo2 _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode