1 | def call_1 ; false ; end |
Because of binding issue of or, x is assigned to return of call_1 first, prior separated calling of call_2. Since what i actually want is to assign x to whichever valid (non nil/false) value of call_1 or call_2, i should use ||, which as a stronger binding, and code as:
1 | x = call_1 || call_2 |
The same applies for && & and.
No comments:
Post a Comment