るりまサーチ

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

別のキーワード

  1. argf.class each
  2. argf.class each_line
  3. argf.class lines
  4. class new
  5. argf.class gets

検索結果

変数と定数 (236.0)

変数と定数 * local * instance * class * class_var_scope * global * pseudo * const * prio

...変数と定数
* local
* instance
* class
* class_var_scope
* global
* pseudo
* const
* prio

Ruby の変数と定数の種別は変数名の最初の一文字によって、
ローカル変数、
インスタンス変数、
クラス変数、
グローバル変数、
定数
のい...
...ら参照できます。初期化されていない
インスタンス変数を参照した時の値はnilです。


===[a:class] クラス変数

//emlist[例][ruby]{
class
Foo
@@foo = 1
def bar
puts @@foo
end
end
//}

@@で始まる変数はクラス変数です。クラス変数はク...
...'$' + 特殊文字一文字」、または「'$' + 10進数字」という名前を持つ変数を特殊変数と呼びます。

また、 $-F や $-I のような変数もあります。
これらは Ruby の起動オプションと -F や -I などと対応しており、オプション変数と...