WHat's the error here?
a = [1,2,3]
if 1 in a
puts "exists"
end
It gives: test.rb:5: syntax error, unexpected keyword_end, expecting
$end
on 2012-11-27 15:23
on 2012-11-27 15:30
Subject: error in if Date: Tue 27 Nov 12 11:22:50PM +0900 Sorry for the delay! Quoting Mohammed Yasin Rahman (Mohammed-Yasin.Rahman@lip6.fr): > WHat's the error here? > > a = [1,2,3] > > if 1 in a > puts "exists" > end > > It gives: test.rb:5: syntax error, unexpected keyword_end, expecting $end "if 1 in a" is not valid Ruby syntax. A working line #3 could be if(a.include?(1)) Carlo
on 2012-11-27 15:33
There is no such construction in Ruby (were you thinking about another language?) try something like a = [1,2,3] if a.include?(1) puts "exists" end On 27 November 2012 14:22, Mohammed Yasin Rahman <
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.