In Ruby you can easily set a default value for a variable
x ||= \"default\"
The above statement will set the value of x to \"default\" if
I wrap it in a function:
function default($value, $default) { return $value ? $value : $default; } // then use it like: $x=default($x, 'default');
Some people may not like it, but it keeps your code cleaner if you're doing a crazy function call.