Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
chc
on Jan 8, 2011
|
parent
|
context
|
favorite
| on:
Which one will execute faster, if(flag==0) or if(0...
I have never seen "if foo = 0" used to set a value for an optional argument in Ruby. It would either be "def bar(foo=0)" or "foo ||= 0". Can you give any example of what you're talking about?
bradly
on Jan 8, 2011
[–]
My mistake. I didn't read parent carefully enough. Although it is common to see something like:
if(@post = Post.find(params[:id])) render @post else render 'Post not found' end
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: