Posts tagged ‘do’

do while in ruby

How to achieve the do ..while loop in Ruby?
Yes this can be, just bit tricky.
Just consider one of the syntax of while loop in ruby

<expression> while <expression>

This repeats evaluation of left hand side expression, while right hand side is true.

x = 5
begin
  print x
  print " "
  x += 1
end while(x<10)

o/p
5 6 7 8 9

April 7, 2008 at 8:17 am Leave a comment


Categories

posts[:recent]

@@name = PRAYAS

This blog has more intention for my self reference@24×7. But if some search engine crawler directs you to my page, believe I may learn form your comments or feedback. Hence feel free to comment good or bad!
prayas2010@gmail.com

visitors[:since_Mar'08]

free web counter

Prayas@Nikon

A colored life

Chhweet Kidss

An independent world

More Photos

Feeds


Follow

Get every new post delivered to your Inbox.