0

I have code like

word.include?("test") ? @test = word : #do nothing

My issue is that rails expects something after the colon and treats the next line of code as if it's part of the conditional statement above. I know I can use a regular if end statement but was curious to know if it's possible to end the statement after the colon and before reaching a new line? Thanks in advance

Steve
  • 4,446
  • 7
  • 35
  • 50

1 Answers1

1

You might consider something like this:

@test = word if word.include?("test")
Eric S
  • 1,363
  • 1
  • 10
  • 20
  • that's a nice alternative thanks, am still hoping if anyone can tell me if it's possible to end the line just so I can learn. Thanks again – Steve Apr 24 '13 at 03:11