It is easy enough to remove this warning (by removing the offending
space).
My question is why is this a warning in Ruby ?
Does having a space there (which IMHO makes things much easier to read)
some kind of risk in Ruby ?
thanks!
It is easy enough to remove this warning (by removing the offending
space).
My question is why is this a warning in Ruby ?
Does having a space there (which IMHO makes things much easier to read)
some kind of risk in Ruby ?
thanks!
hi Frank,
well, someone else can probably explain why - but in ruby you have the
option of using a space OR parenthesis, but not both… (though notice
that line 4 still returns true)
irb(main):001:0> a = %w[red blue green]
=> [“red”, “blue”, “green”]
irb(main):002:0> a.include?(‘red’)
=> true
irb(main):003:0> a.include? ‘red’
=> true
irb(main):004:0> a.include? (‘red’)
(irb):4: warning: don’t put space before argument parentheses
=> true
def aa(a) a*10 end
p aa(2+1)
p aa(2)+1
p aa (2)+1
give :
30
21
30
So blank before parenthese are open dor for very vicious bug.
frank houser wrote in post #1007730:
It is easy enough to remove this warning (by removing the offending
space).My question is why is this a warning in Ruby ?
Does having a space there (which IMHO makes things much easier to read)
some kind of risk in Ruby ?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs