unless in Ruby on rails

By: Brian Marick Emailed: 1728 times Printed: 2331 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The word “unless” is in the English language for a reason. Contrast “unless the judge is unfair, you’ll win” with “if the judge is not unfair, you’ll win.” Negations - especially negations of already negative ideas can be confusing. The same is true of Ruby code:

unless unfair(judge)

winner = you

end

if not unfair(judge)

winner = you

end

You can also use unless with the one-line form:

array.pop unless array.empty?


Ruby Home | All Ruby Tutorials | Latest Ruby Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Brian Marick
The Question Mark Operator in Ruby on rails
unless in Ruby on rails
if . . . elsif . . . else in Ruby on rails
Methods in Ruby on rails
Command-line Arguments in Ruby on rails
Naming conventions in Ruby on rails

More Tutorials in Ruby
Standard Library Packages in Ruby
Module Abbrev in Ruby
encoding and decoding in Ruby using Base64 Module
Benchmark module in Ruby
benchmark(caption = "", label_width = nil, fmtstr = nil, *labels) {|report| ...} in Ruby
bm(label_width = 0, *labels) {|report| ...} in Ruby
bmbm(width = 0) {|job| ...} in Ruby
CGI class in Ruby
URL encode a string in Ruby
escapeElement() in Ruby
escapeHTML() in Ruby
new(type = "query") in Ruby
parse(query) in Ruby
pretty() in Ruby
Format a Time object as a String in Ruby

More Latest News
Most Viewed Articles (in Ruby )
Command-line Arguments in Ruby on rails
unless in Ruby on rails
escapeElement() in Ruby
parse(query) in Ruby
Format a Time object as a String in Ruby
dRuby client/server mode sample program
FTP using Ruby
IMAP in Ruby
Using Generator in Ruby
Action Pack - Ruby On rails from request to response
Getting started with Ruby on rails
Prompts, Command Lines, Prompts, and irb in Ruby on rails
Naming conventions in Ruby on rails
Methods in Ruby on rails
if . . . elsif . . . else in Ruby on rails
Most Emailed Articles (in Ruby)
Methods in Ruby on rails
Prompts, Command Lines, Prompts, and irb in Ruby on rails
Command-line Arguments in Ruby on rails
Standard Library Packages in Ruby
bm(label_width = 0, *labels) {|report| ...} in Ruby
escapeHTML() in Ruby
unescapeElement() in Ruby
Using Proxy to connect to URLs in Ruby
IMAP in Ruby
Reading emails using POP3 in Ruby
Using Observer in Ruby
Using Forwardable in Ruby
Sending emails and Receiving emails using Ruby On rails
Getting started with Ruby on rails
Naming conventions in Ruby on rails