A part of a program with aside effect performs a noticeable action other than giving back avalue.[1] Examples include showing a picture on acomputer screen, or checking what year it is. Code with side effects can be harder to understand without any context, and the order of instructions is more important for code with side effects.[2]
Infunctional programming, programmers try to avoid side effects when they can, so it is easier to prove that a program will always do what it is supposed to. In some functional languages, likeStandard ML,Scheme, orScala, side effects are not restricted, but programmers still try to use them less.[3] InHaskell, actions with side effects must be stated explicitly—this makes it easier to tell what code does or does not have them.[4]
{{cite book}}: CS1 maint: location missing publisher (link)