

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Pure Functions
incomplete
2: Pure Function Review
incomplete
3: Reference vs. Value
incomplete
4: Pass by Reference Impurity
incomplete
5: Input and Output
incomplete
6: Should I I/O?
incomplete
7: No-Op
incomplete
8: Memoization
incomplete
9: Referential Transparency
incomplete
10: Pure Functions Practice
incomplete
11: Pure Functions Practice
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Comic by xkcd.
The term "i/o" stands for input/output. In the context of writing programs, i/o refers to anything in our code that interacts with the "outside world." And "outside world" just means anything that's not stored in our application's memory (like variables).
Reading from or writing to a file on the hard drive
Accessing the internet
Reading from or writing to a database
Even simply printing to the console!!
All i/o is a form of "side effect."
In Doc2Doc, we frequently need to change the casing of some text. For example:
Every Day Once A Day Give Yourself A Present
every day once a day give yourself a present
EVERY DAY ONCE A DAY GIVE YOURSELF A PRESENT
There's an issue in the convert_case function; our test suite can't test its behavior because it's printing to the console (eww, a side effect) instead of returning a value. Fix the function so that it returns the correct value instead of printing it.