Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Pure Function Practice | Pure vs Impure Functions & Stepwise Decomposition
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# Methods & Modular Thinking

bookChallenge: Pure Function Practice

Tâche

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 ArgumentException if the input is negative.
  • Ensure the method does not read from or modify any external state.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 2
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Pure Function Practice

Glissez pour afficher le menu

Tâche

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 ArgumentException if the input is negative.
  • Ensure the method does not read from or modify any external state.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 2
single

single

some-alt