Stray Puts

Andre Garzia andre at andregarzia.com
Fri Feb 24 17:22:47 EST 2012


On Fri, Feb 24, 2012 at 7:55 PM, Dar Scott <dsc at swcp.com> wrote:

> Is there any advantage of using a debug constant over commenting out the
> body of the log?


no advantage at all... actually, the commented version will run faster
because it does not execute the if statement to check for constant value.
The thing about constants is that you can script your log function to
behave differently depending on the constant value such as:

constant kDebug = "msg"

on log pText
  switch kDebug
  case "msg"
    put pText
    break
  case "file"
    put pText & cr after url ("file:" && the effective filename of this
stack & ".log")
    break
  end switch
end log

Then you have added benefits...


-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.



More information about the use-livecode mailing list