Factorial in ruby | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Factorial in ruby

Def factorial(x) Puts 1.upto(x).inject('*') end factorial(5) Can anyone explain how this is executing ??

4th Mar 2022, 5:24 PM
SHIVAM ROHILLA
1 Answer
0
Actually I want to understand Puts 1.upto(x).inject('*)
5th Mar 2022, 3:25 AM
SHIVAM ROHILLA