Challenge: Pure Function Practice
Tarea
Swipe to start coding
Write a method 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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 3. Capítulo 2
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Genial!
Completion tasa mejorada a 8.33
Challenge: Pure Function Practice
Desliza para mostrar el menú
Tarea
Swipe to start coding
Write a method 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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 3. Capítulo 2
single