Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- intNumbers = [1, -2, -3, 3, 4]
- puts "Начальный массив: #{intNumbers}"
- result = []
- intNumbers.each do |val|
- if val > 0
- result << 0 << val
- else
- result << val
- end
- end
- puts "Конечный массив: #{result}"
Add Comment
Please, Sign In to add comment