def is_fibonacci?(i,a=0, b=1)
i > a ? is_fibonacci?(i, a + b, a) : a <= i if true
end
I've never seen a <= i if true
it seems to say "return true if a <=i and return false otherwise"
But are there more examples of this strange order I can look at?
I've never seen a <= i if true
<=
is one of the Ruby Comparison Operators:
Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
i > a ? is_fibonacci?(i, a + b, a) : a <= i if true
means - i > a ? is_fibonacci?(i, a + b, a) : a <= i
the whole expression will be evaluated when your if
condition results in true
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With