Skip to content

Commit

Permalink
corrected1
Browse files Browse the repository at this point in the history
  • Loading branch information
YuliyaBond committed Mar 15, 2018
1 parent e21b75b commit 73d207c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions 2018/YuliyaBondareva/1/pascal_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ def tree(number, base_number)
puts 'Depth?'
number = gets.chomp
base_number = ENV['BASE']
while number.to_i <= 0 do
puts 'depth must be positive. '
puts 'Depth?'
number = gets.chomp

if number.to_i <= 0
loop do
puts 'depth must be positive. '
puts 'Depth?'
number = gets.chomp
break if number.to_i > 0
end
end
while base_number.to_i <= 0 do
puts 'BASE must be positive. '
puts 'BASE?'
base_number = gets.chomp
if base_number.to_i <=0
loop do
puts 'BASE must be positive. '
puts 'BASE?'
base_number = gets.chomp
break if base_number.to_i > 0
end
end
tree(number.to_i, base_number.to_i)

0 comments on commit 73d207c

Please sign in to comment.