Lines Matching full:pure
1477 <li><span class="heading">Pure functions</span>
1478 <p>Pure functions have two properties. Firstly, the result depends only on the input values and
1480 cause any observable side effects or changes to global state. For example <i>sin(x)</i> is pure
1483 <p>As much of the code as possible should be kept pure. Moving pure parts of logic and computation
1484 into separate functions is recommended. Unit testing those pure functions is then much easier.</p>
1486 <p>Mutating objects passed in counts as a side effect. Instead pure functions must return a completely
1488 reasons. One way to work around that while remaining as pure as possible is to use separate output-only
1493 // Good: pure function (assuming that it doesn't touch global state)