Debugging print
For debugging purposes, however, there is a better solution. Instead of using the `println!' one could use the dbg! macro. Not only will it print the content of the variable, it will also print the name of the file, the line number and the name of the variable.
The only drawback, or maybe that is another advantage?) might be that everything is being printed to to the Standard Error channel STDERR
.
fn main() { let name = "Foo"; dbg!(name); }
Output on STDERR:
[src/main.rs:3:5] name = "Foo"
- dbg!