るりまサーチ

最速Rubyリファレンスマニュアル検索!
722件ヒット [301-400件を表示] (0.121秒)
トップページ > クエリ:ruby[x] > クエリ:Ruby[x] > 種類:インスタンスメソッド[x] > クエリ:r[x] > クエリ:@[x] > クラス:Integer[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 5 6 ... > >>

Integer#div(other) -> Integer (3132.0)

整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。

...er Integer オブジェクトの場合、Integer#/ の結果と一致します。

div に対応する剰余メソッドは modulo です。

@
param other 二項演算の右側の引数(対象)
@
return 計算結果

//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div(R...
...=> 3

begin
2.div(0)
r
escue => e
e # => #<ZeroDivisionError: divided by 0>
end

begin
2.div(0.0)
r
escue => e
e # => #<ZeroDivisionError: divided by 0>
# Integer#/ と違い、引数が Float でもゼロで割ることはできない
end
//}

@
see Integer#fdiv, Integer#/, Integer#modulo...

Integer#downto(min) -> Enumerator (3132.0)

self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。

...で 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。

@
param min 数値
@
return self を返します。

//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}

@
see Integer#upto, Numeric#step, Integer#times...

Integer#inspect(base=10) -> String (3132.0)

整数を 10 進文字列表現に変換します。

...現に変換します。

//emlist[][ruby]{
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
//}

@
return 数値の文字列表現
@
param base 基数となる 2 - 36 の数値。
@
raise ArgumentError base に 2 - 36 以外の数値を指定...

Integer#to_s(base=10) -> String (3132.0)

整数を 10 進文字列表現に変換します。

...現に変換します。

//emlist[][ruby]{
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
//}

@
return 数値の文字列表現
@
param base 基数となる 2 - 36 の数値。
@
raise ArgumentError base に 2 - 36 以外の数値を指定...

Integer#upto(max) -> Enumerator (3132.0)

self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。

...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。

@
param max 数値
@
return self を返します。

//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}

@
see Integer#downto, Numeric#step, Integer#times...

絞り込み条件を変える

Integer#upto(max) {|n| ... } -> Integer (3132.0)

self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。

...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。

@
param max 数値
@
return self を返します。

//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}

@
see Integer#downto, Numeric#step, Integer#times...

Integer#%(other) -> Numeric (3126.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}

@
param other 二項演算の右側の引数(対象)
@
return 計算結果...

Integer#*(other) -> Numeric (3126.0)

算術演算子。積を計算します。

...算術演算子。積を計算します。

@
param other 二項演算の右側の引数(対象)
@
return 計算結果

//emlist[][ruby]{
2 * 3 # => 6
//}...

Integer#+(other) -> Numeric (3126.0)

算術演算子。和を計算します。

...算術演算子。和を計算します。

@
param other 二項演算の右側の引数(対象)
@
return 計算結果

//emlist[][ruby]{
3 + 4 # => 7
//}...
<< < ... 2 3 4 5 6 ... > >>