An implicit output is an effect of a computation that its return value does not represent. Side effects and exceptions are hidden outputs; changing internal or external state is a common example. section 6.3 section 6.6
Recognize implicit outputs by checking whether:
- Replacing a method call with its return value changes program behavior, indicating a lack of referential transparency. section 6.3
- The method changes internal state, as AddComment does when it adds a comment to a collection. section 6.3
- The computation raises an exception or otherwise produces an effect not expressed in its signature. section 6.6
State-changing method
AddComment(string text) returns a Comment, but also appends it to _comments. The returned object therefore does not describe the method's complete output. section 6.3
public decimal CalculateDiscount(Product[] products)
{
decimal discount = products.Length * 0.01m;
return Math.Min(discount, 0.2m);
}
Contrast this explicit calculation with state-changing methods: its input and decimal result are fully represented by the signature. section 6.3

