Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualrip-off

Posted 01 August 2013 - 01:50 PM

Many dynamic languages allow you to write code like the following:

result = (bar.getStringValue() or "Default string")
result = bar.getStringValue() || "Default string"

In some, statement are also expression, and the last evaluated value is the overall result: 

def foo()
    if rand() < 0.5
        return "Yay!"
    end
    raise "Oh no"
end
 
x = begin foo() rescue "Default string" end

#1rip-off

Posted 01 August 2013 - 01:48 PM

Many dynamic languages allow you to write code like the following:

result = bar.getStringValue() or "Default string"

 

In some, statement are also expression, and the last evaluated value is the overall result: 

def foo()
    if rand() < 0.5
        return "Yay!"
    end
    raise "Oh no"
end
 
x = begin foo() rescue "Default string" end

PARTNERS