is there in objective-c something similar to ruby's:
foobar = foo || bar
while foo is nil and bar is 1... so foobar will become 1 or something else if foo wouldn't be nil :)
Use C's ternary conditional operator:
foobar = foo != nil ? foo : bar;
In general, it takes the form
<var> = <condition to test> ? <true value> : <false value>;
As Wevah noted, if you enable GNU C99 extensions (-std=gnu99) you can also do
foobar = foo ?: bar