Effects Versus Results
We'll cover the following...
What is the value of this expression?
Press + to interact
println!("Hello, world!")
Most people would think that it’s the string “Hello, world!” That’s not actually the case. We need to talk about the difference between an effect and a result.
An effect is something that is caused when you evaluate an expression. In our example above, the macro call println!
causes the output to be printed to the screen. You could have a program that talks to Amazon with a function call order_pokeballs(12)
that causes 12 Pokeballs to be sent to your house. That would be the effect of evaluating that expression. ...