programming.nbk: Home | Index | Next Page: Ruby: Widget Callbacks | Previous Page: Ruby: TkVariable


 Ruby: unless

    unless ARGV.length == 2   
        puts "Usage: program.rb 23 45"  
        exit   
    end  

The unless construct executes the enclosed code except when the condition is true. It is a shorthand notation for:

    if not condition then
        stuff
    end

programming.nbk: Home | Index | Next Page: Ruby: Widget Callbacks | Previous Page: Ruby: TkVariable


Notebook exported on Monday, 7 July 2008, 18:56:06 PM Eastern Daylight Time