T
Tom Cloyd
I'm missing something here, and cannot see the problem:
x='1'
(1..5).include? x.to_i # => true
But...
x='1'
case
when x =='0'
puts '0'
when (1..5).include? x.to_i
puts '1'
end
...won't even compile. Can someone tell me why? (and maybe how to fix it...)
What I'm having to do is this, which works:
...
when ((1,,5).to_a & [x.to_i]).length > 0 # <-- ERROR CORRECTED
...
but it seems over-wrought.
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< (e-mail address removed) >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
x='1'
(1..5).include? x.to_i # => true
But...
x='1'
case
when x =='0'
puts '0'
when (1..5).include? x.to_i
puts '1'
end
...won't even compile. Can someone tell me why? (and maybe how to fix it...)
What I'm having to do is this, which works:
...
when ((1,,5).to_a & [x.to_i]).length > 0 # <-- ERROR CORRECTED
...
but it seems over-wrought.
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< (e-mail address removed) >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~