Alex Smolov
Alex Smolov

Reputation: 1861

Ruby syntax for while block in one line

Could you please tell, what is the Ruby syntax for while block in one line?

Upvotes: 5

Views: 6566

Answers (2)

woz
woz

Reputation: 10994

Simple:

while 1 do puts "hello" end

Upvotes: 4

Matt
Matt

Reputation: 20786

For example

puts a[i+=1] while i < 10

Upvotes: 17

Related Questions