From: "Shirai,Kaoru" Date: 2002-08-19T20:31:54+09:00 Subject: Re: equivalent of python's __debug__ Hi. > if __debug__: > print "there are %d eggs in the basket now." % (eggs) > will be optimized away. > is there similar thing in ruby? or do i have to use a preprocessor? Interpreter switch '-d' and $DEBUG may help you. This may be good for tiny script, but running large application with -d switch is often so verbose. I recommands you to use some logger library. Example (using OBAQ): require 'obaq/log' class MyClass LOG = Obaq::Log.class_log(self) ... def func LOG.debug { # This block only performs when logger is configured debugging mode. "..." } end end Thanks. -- shirai@p1jp.com Shirai,Kaoru PlusOne Co.,Ltd