########Programming Fundamental######## # If it can happen, it will happen. # Control your flow so crap can't happen. class AnythingElse def initialize @anything_else = 'anything else' end def to_s return @anything_else end end def can_happen(*anything) if anything.length >= 1 anything.each do |thing| if thing && thing != true raise "I don't understand " + thing.to_s elsif thing == false puts "If it is #{thing} it Cannot Happen" elsif thing == nil puts "If it is nothing it Cannot Exist." else puts "If it is #{thing} it Will Happen" end end else puts "If it is nothing it Cannot Exist" end end begin can_happen() can_happen(false, nil, true) can_happen(AnythingElse.new, 'crap', 'can\'t happen', 0, 0.0, 'true') rescue Exception => e puts e.inspect print e.backtrace.join("\n") else puts "I fully understand!" ensure puts "You cannot fool me!" end