AW wrote: > Hi, > As i get better writing ruby scripts (im pretty new), I often wonder > if im not exploiting the power of the language or that i'm casting > precedural language ideas onto my ruby scripts. I have here a little C > program that would like some of you to Rubi-tize if possible, so that > i can see how some of you that really know the language use it. I'm very new, only started looking at Ruby Saturday / Sunday time. I like it though :) Without looking at anyones attempts other than the C code, this is my stab at it. /-- code --/ # example to print stars to screen def printStar(location) (1...location).each { |x| print " " } print "*\n" end screenWidth = 78; if ARGV.size == 1 # use argument unless its not a int (to_i returns 0 if item not an integer) screenWidth = ARGV[0].to_i unless ARGV[0].to_i == 0 end # forward 1.upto(screenWidth) {|n| printStar(n)} # back screenWidth.downto(1) {|n| printStar(n)}