Test.rb

utf-8 BOM無しです - Teruaki Komiya, 01/23/2013 09:54 PM

Download (299 Bytes)

 
1
#!ruby -Ku
2
array = Array["red","blue","green"]
3
p array
4
print"length =", array.length ,"\n"
5
print"nitems =", array.nitems ,"\n\n" #nitemsはnilを除きます
6

    
7
array[5] = "white"
8
print 'array[5] = "white"' + "\n"
9
p array
10
print"length = ",array.length,"\n"
11
print"nitems = ",array.nitems,"\n"