>>>>> "S" == Schaefer, F <fschaef / ces.clemson.edu> writes:

S> 1) how do I compare an integer against let's say '\n' or ' ' 

S>    something like 

S> 	if value == ' ' or value == '\t' or value == '\n' 

S>    I can do it for 'a' by saying ?a ... but how about special
S>    characters and whitespace ?

pigeon% ruby
a = "\t \n"
puts "ok" if a[0] == ?\t
puts "ok" if a[1] == ?       # there is a space after ?
puts "ok" if a[2] == ?\n
^D
ok
ok
ok
pigeon% 

    
S> 2) The function and subscription operators: how can I overload
S>    them. I'm using ruby 1.6.2. Am I out of date ?

For susbcript, i.e. #[]

pigeon% ruby
class Array
  def [](a)
     puts "here [] #{a}"
  end
end

a = [1, 2]
a[0] 
^D
here [] 0
pigeon% 


Guy Decoux