るりまサーチ

最速Rubyリファレンスマニュアル検索!
7件ヒット [1-7件を表示] (0.058秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

検索結果

Vector#[]=(index, value) (18211.0)

index 番目の要素を value に変更します。

...
i
ndex 番目の要素を value に変更します。

@param index インデックスを整数で指定します。
@param value 設定したい要素の値を指定します。
@raise TypeError ベクトルの範囲外にある整数を指定したときに、発生します。

//emlist[][ruby]{...
...require 'matrix'

v = Vector[0, 0, 0, 0, 0]

v[1] = 2
p v #=> Vector[0, 2, 0, 0, 0]

v[-1] = 3
p v #=> Vector[0, 2, 0, 0, 3]

v[99] = 100
# IndexError: given index 99 is outside of -5...5
//}...