Snake case
Snake case is a way of writing phrases without spaces, where spaces are replaced with underscores _
, and the words are typically all lower case. It's often stylized as "snake_case" to remind the reader of its appearance.
Snake casing is often used as a variable naming convention. The following names are in snake case: left_shift
, bitwise_invert
, matrix_transpose
.
Note that snake case never contains upper case letters. Sometimes, constants are written in all-uppercase, such as JavaScript's Number.MAX_SAFE_INTEGER
. This is not typically considered as snake case. Instead, it is sometimes called screaming snake case.
Snake case is the most popular convention in Python, Rust, and various other languages.