From: Michael Neumann Date: 2003-06-01T02:11:31+09:00 Subject: Re: newbie questions On Sun, Jun 01, 2003 at 02:00:29AM +0900, Steven Ketcham wrote: > > Moving from C++ > > Q1.) Is there an equivalent to enumerated types? Not really, but: BLUE, RED, WHITE = (0..2).to_a will do similar things. > Q2.) Is there an equivalent to the const declaration for function parameters? What prevents a function parameter from being > accidently changed? There are not type declarations in Ruby. But you can freeze object, by calling it's freeze method. Those objects cannot be modified, but it's up to the called to do this! Another way would be to copy the objects at the top of the method (using it's dup method). Regards, Michael -- ruby -r complex -e 'c,m,w,h=Complex(-0.75,0.136),50,150,100;puts "P6\n#{w} #{h}\n255";(0...h).each{|j|(0...w).each{|i| n,z=0,Complex(.9*i/w,.9*j/h);while n<=m&&(z-c).abs<=2;z=z*z+c;n+=1 end;print [10+n*15,0,rand*99].pack("C*")}}'|display