corck
1
sorry for this newbie question, just started ruby programming today,
Try to work me through the book Programming Ruby
the script:
#!/usr/local/bin/ruby
a = [ “a”, “b”, “c” ]
a.include?(“b”)
returns me nothing,
if I do the same in “irb”
it returns “true”
why does it not work in the shell script??
corck
2
Christoph,
your script doesn’t do anything with the return-value of ‘include?’
try this:
#!/usr/local/bin/ruby
a = [ “a”, “b”, “c” ]
p a.include?(“b”)
corck
4
Try changing the last line of your script to,
puts a.include?(“b”)
irb automatically prints out the evaluation of an expression.
Peter.