Page 1 of 1

Handler for returning a value

Posted: Sat May 24, 2014 10:46 am
by jalz
Hi all,

Just a general question as i explore refactoring some of my long code into smaller effiecient handlers i can call again. Am i right in thinking that only a function can return a value?

Thanks
Jalz

Re: Handler for returning a value

Posted: Sat May 24, 2014 11:28 am
by Klaus
Hi Jaz,
Am i right in thinking that only a function can return a value?
no Sir! :D

A handler can also return a value, but you have to retrieve THE RESULT :D

Example:

Code: Select all

command anyhanlder
  ...
  dothat
  put the result into tReturnedValue
  ## Do somehting with that variable
end anyhandler

command dothat
  ## do something here and output the result
  ## Cheap-o example:
  put 10*20 into tResult
  RETURN tResult
end dothat
Hope that helps!


Best

Klaus

Re: Handler for returning a value

Posted: Sat May 24, 2014 11:40 am
by jalz
Thanks Klaus - just what i was looking for :)

Re: Handler for returning a value

Posted: Sat May 24, 2014 11:47 am
by Klaus
Hi Jalz,
jalz wrote:Thanks Klaus - just what i was looking for :)
I know! :D


Best

Klaus