condition || raise("error")
ruby
Solution
What you have doesn't work because you need parenthesis:
1 > 2 || p("test")
Note that `or` (and `and`) has a different precedence than `&&`/`||` and thus will work without parenthesis (and with what you're doing makes more semantic sense):
1 > 2 or p "test"
as will `unless`:
p "test" unless 1 > 2
Problem
I'm just wondering where this syntax documented: ``` 1 > 2 || raise("error") ``` I have tried use it as condition: ``` 1 > 2 || p "test" ``` but it doesn't work: ``` SyntaxError: (irb):9: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' 1 > 2 || p "test" ^ from C:/Ruby193/bin/irb:12:in `<main>' ```