120件ヒット
[1-100件を表示]
(0.011秒)
キーワード
-
$ DEFAULT _ INPUT (12) -
$ DEFAULT _ OUTPUT (12) -
$ INPUT _ LINE _ NUMBER (12) -
$ INPUT _ RECORD _ SEPARATOR (12) -
$ NR (12) -
$ OUTPUT _ FIELD _ SEPARATOR (12) -
$ OUTPUT _ RECORD _ SEPARATOR (12) -
$ RS (12) - putc (12)
- puts (12)
検索結果
先頭5件
-
Kernel
$ $ DEFAULT _ INPUT -> IO (6101.0) -
$< の別名
...$< の別名
require "English"
while line = $DEFAULT_INPUT.gets
p line
end
# end of sample.rb
ruby sample.rb < /etc/passwd
# => "hoge:x:500:501::/home/hoge:/bin/bash\n"
...... -
Kernel
$ $ DEFAULT _ OUTPUT -> IO (6101.0) -
$> の別名
...$> の別名
require "English"
dout = $DEFAULT_OUTPUT.dup
$DEFAULT_OUTPUT.reopen("out.txt", "w")
print "foo"
$DEFAULT_OUTPUT.close
$DEFAULT_OUTPUT = dout
p "bar" # => bar
p File.read("out.txt") #=> foo... -
Kernel
$ $ INPUT _ LINE _ NUMBER -> Integer (6101.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5... -
Kernel
$ $ INPUT _ RECORD _ SEPARATOR -> String | nil (6101.0) -
$/ の別名
...$/ の別名
require "English"
$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]
__END__
ugo|ego|fogo... -
Kernel
. # putc(ch) -> object (6101.0) -
文字 ch を 標準出力 $stdout に出力します。
...きないオブジェクトを引数に
指定した場合に発生します。
//emlist[例][ruby]{
putc("ch")
putc(?c)
putc(99)
putc(355)
#=> cccc
putc(99.00) #=> c
putc(33333333333333333333333333333333333) # bignum too big to convert into `long' (RangeError)
//}
@see IO#putc... -
Kernel
. # puts(*arg) -> nil (6101.0) -
引数と改行を順番に 標準出力 $stdout に出力します。 引数がなければ改行のみを出力します。
...、
次に to_s メソッドにより文字列へ変換を試みます。
末尾が改行で終っている引数や配列の要素に対しては puts 自身
は改行を出力しません。
@param arg 出力するオブジェクトを任意個指定します。
@raise IOError 標準出力が書......に失敗した場合に発生します。
//emlist[例][ruby]{
puts "foo", "bar\n", "baz"
puts "" # 改行のみ出力
puts # 改行のみ出力
puts nil # 改行のみ出力
puts ["oui", "non"]
#=> foo
# bar
# baz
#
#
#
# oui
# non
//}
@see Kernel.#print, Kernel.#p, IO#puts... -
Kernel
$ $ OUTPUT _ FIELD _ SEPARATOR -> String | nil (3101.0) -
$, の別名
...$, の別名
require "English"
array = %w|hoge fuga ugo bar foo|
p array.join #=> "hogefugaugobarfoo"
$OUTPUT_FIELD_SEPARATOR = ","
p array.join #=> "hoge,fuga,ugo,bar,foo"... -
Kernel
$ $ OUTPUT _ RECORD _ SEPARATOR -> String | nil (3101.0) -
$\ の別名
...$\ の別名
require "English"
print "hoge\nhuga\n"
$OUTPUT_RECORD_SEPARATOR = "\n"
print "fuge"
print "ugo"
# end of sample.rb
ruby sample.rb
hoge
huga
fuge
ugo... -
Kernel
$ $ NR -> Integer (3001.0) -
$. の別名
...$. の別名
1 e
2 f
3 g
4 h
5 i
# end of a.txt
require "English"
File.foreach(ARGV.at(0)){|line|
# read line
}
p $INPUT_LINE_NUMBER
# end of sample.rb
ruby sample.rb a.txt
#=> 5...