Challenge: Pure Function Practice
Swipe to start coding
Write a method CalculateFactorial that calculates the factorial of a given integer in a pure manner. The function must not cause any side effects and should only depend on its input.
- Return the correct factorial value for non-negative integer input.
- Throw an
ArgumentExceptionif the input is negative. - Ensure the method does not read from or modify any external state.
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Génial!
Completion taux amélioré à 8.33
Challenge: Pure Function Practice
Glissez pour afficher le menu
Swipe to start coding
Write a method CalculateFactorial that calculates the factorial of a given integer in a pure manner. The function must not cause any side effects and should only depend on its input.
- Return the correct factorial value for non-negative integer input.
- Throw an
ArgumentExceptionif the input is negative. - Ensure the method does not read from or modify any external state.
Solution
Merci pour vos commentaires !
single