Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Inverted-syntax/Ruby/inverted-syntax.rb
Normal file
15
Task/Inverted-syntax/Ruby/inverted-syntax.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Raise ArgumentError if n is negative.
|
||||
if n < 0 then raise ArgumentError, "negative n" end
|
||||
raise ArgumentError, "negative n" if n < 0
|
||||
|
||||
# Exit 1 unless we can call Process.fork.
|
||||
unless Process.respond_to? :fork then exit 1 end
|
||||
exit 1 unless Process.respond_to? :fork
|
||||
|
||||
# Empty an array, printing each element.
|
||||
while ary.length > 0 do puts ary.shift end
|
||||
puts ary.shift while ary.length > 0
|
||||
|
||||
# Another way to empty an array, printing each element.
|
||||
until ary.empty? do puts ary.shift end
|
||||
puts ary.shift until ary.empty?
|
||||
Loading…
Add table
Add a link
Reference in a new issue