ruby-uebungen/Assignment_019/solution/readme.md

10 lines
398 B
Markdown
Raw Normal View History

2023-05-23 09:19:31 +02:00
# Lösung: Vararg-Methoden
<div style="border: 1px solid grey;"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div>```ruby
def produkt(*p)
p.reduce { |s, e| s *= e }
end
puts produkt(5, 7, 8, 1)
```