るりまサーチ

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric -@
  4. numeric %
  5. numeric i

ライブラリ

キーワード

検索結果

<< < 1 2 3 >>

Integer#upto(max) -> Enumerator (26.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 (26.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#[](nth) -> Integer (20.0)

nth 番目のビット(最下位ビット(LSB)が 0 番目)が立っている時 1 を、そうでなければ 0 を返します。

...目のビット(最下位ビット(LSB)が 0 番目)が立っている時 1
を、そうでなければ 0 を返します。

@
param nth 何ビット目を指すかの数値
@
return 1 か 0

//emlist[][ruby]{
a = 0b11001100101010
30.downto(0) {|n| print a[n] }
# => 0000000000000000011001100101...
...00011110010100111100010111001
//}

n[i] は (n >> i) & 1 と等価なので、負のインデックスは常に 0 を返します。

//emlist[][ruby]{
p 255[-1] # => 0
//}


self[nth]=bit (つまりビットの修正) がないのは、Numeric 関連クラスが
immutable であるためです。...

Integer#ceil(ndigits = 0) -> Integer (20.0)

self と等しいかより大きな整数のうち最小のものを返します。

...self と等しいかより大きな整数のうち最小のものを返します。

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。...
...//emlist[][ruby]{
1.ceil # => 1
1.ceil(2) # => 1
18.ceil(-1) # => 20
(-18).ceil(-1) # => -10
//}

@
see Numeric#ceil...

Integer#ceil(ndigits = 0) -> Integer | Float (20.0)

self と等しいかより大きな整数のうち最小のものを返します。

...

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.ceil # => 1
1.ceil(2) # => 1.0
18.ceil(-1) # => 20
(-18).ceil(-1) # => -10
//}

@
see Numeric#ceil...

絞り込み条件を変える

Integer#floor(ndigits = 0) -> Integer (20.0)

self と等しいかより小さな整数のうち最大のものを返します。

...self と等しいかより小さな整数のうち最大のものを返します。

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。...
...//emlist[][ruby]{
1.floor # => 1
1.floor(2) # => 1
18.floor(-1) # => 10
(-18).floor(-1) # => -20
//}

@
see Numeric#floor...

Integer#floor(ndigits = 0) -> Integer | Float (20.0)

self と等しいかより小さな整数のうち最大のものを返します。

...

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.floor # => 1
1.floor(2) # => 1.0
18.floor(-1) # => 10
(-18).floor(-1) # => -20
//}

@
see Numeric#floor...

Integer#truncate(ndigits = 0) -> Integer (20.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

...0 から self までの整数で、自身にもっとも近い整数を返します。

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます...
...

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@
see Numeric#truncate...

Integer#truncate(ndigits = 0) -> Integer | Float (20.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

...

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1.0
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@
see Numeric#truncate...

Integer#times -> Enumerator (14.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

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

絞り込み条件を変える

Integer#times {|n| ... } -> self (14.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@
see Integer#upto, Integer#downto, Numeric#step...
<< < 1 2 3 >>