Created
January 29, 2021 21:16
-
-
Save justanotherdot/01f25394df97486a0ab3eeb14203b4c0 to your computer and use it in GitHub Desktop.
Avoid prefixing variables you will use with an underscore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rust Idiom: | |
// prefixing a variable with an underscore | |
// signals to others that the variable | |
// isn't going to be used, not that it is | |
// intentionally private or an updated | |
// variable. | |
main () { | |
let x = 12; | |
// _x reads as | |
// "I don't care about this x but I want | |
// to tell you it's x-like or from x" | |
let _x = x + 1; | |
dbg!(_x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment