テスト
Posted feedbacks - Ruby
テスト
1 2 3 4 5 | begin
require 'test'
rescue
puts "テスト失敗"
end
|
line1 line2 line3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | def bingo(num)
raise ArgumentError.new("fixnum only") unless num.kind_of? Fixnum
raise ArgumentError.new("1 ijyou de onegai simasu") unless num >= 1
results = []
ary=(1..num).to_a
ary.size.times{
index = (rand * ary.size).to_i
results << ary.delete_at(index)
}
results
end
|
1 | test
|
わー
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!usr/local/bin/ruby
puts "Hello!,World!"
puts "Hi","How are u?"
text = "Hi,Hello!,How are u today?"
text.sub("H","B")
print text
i = 1
while i <= 10
print i,"\n"
i = i + 1
end
5.times{
puts "5回表示を繰り返すよ"
}
|
テストテスト。
再帰表現が大好きです。
メモリを無駄に食っても大好きです。
昨晩寝る前にFizzBuzzしたのをテストテスト。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | class Fixnum
def foo
case 0
when self-101
return
when self%15
return self.hoge('fizzbuzz')
when self%5
return self.hoge('buzz')
when self%3
return self.hoge('fizz')
else
return self.hoge
end
end
def hoge(str=self)
puts str
self.next.foo
end
end
1.foo
|
テスト
テスト
1 2 3 4 5 6 7 8 9 10 | test = ["テ", "ス", "ト"]
for t in test
print t
end
print "\n"
test.each do |t|
print t
end
|
test
1 2 3 4 5 | def test
puts test
end
test
|
tesuton
test
1 2 3 | begin
test
end
|



にしお
#3357()
Rating0/0=0.00
[ reply ]