Challenge: Pure Function Practice
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 3. Capítulo 2
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Incrível!
Completion taxa melhorada para 8.33
Challenge: Pure Function Practice
Deslize para mostrar o menu
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 3. Capítulo 2
single