[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02087] Array trouble

From: "Dat Nguyen" <thucdat@...>
Date: 2000-03-22 22:51:15 UTC
List: ruby-talk #2087
$ ruby -v
ruby 1.4.3 (1999-12-08) [i586-linux]
$ruby sample/irb.rb
irb(main):001:0> ary = Array.new(3,5)
[5, 5, 5]
irb(main):002:0> ary[0..2] = 7
7
irb(main):003:0> ary
[7]
irb(main):004:0> ary[0]
7
irb(main):005:0> ary[1]
nil
irb(main):006:0>

According to the Ruby manual:
self[start..end] = val
Replace the items from start to end with val. If val is not an array,
the type will be converted into the Array using to_a method.

But my exercise above did not do that. Why?

Dat
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

In This Thread

Prev Next