Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 329 Bytes

ruby-debug-flag.md

File metadata and controls

23 lines (16 loc) · 329 Bytes

Ruby debug flag

def var
  @var || 40
end

if $DEBUG
  p "var is %p" % var
end

p var + 2

# Result:
# ruby_debug_flag.rb:2: warning: instance variable @var not initialized
# "var is 40"
# ruby_debug_flag.rb:2: warning: instance variable @var not initialized
# 42

View Source