var iLikeSnakeCase = "asdf"
echo i_like_snake_case
Is this feature of the nim? It's a stupid question. sorry.
Hi, that can be surprising indeed, because very few languages do this. In case of Nim it's partial case insensitivity that does this. You can read more at https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
Basically, only the first character in identifiers is case-sensitive, all others are case-insensitive, and underscores are ignored when comparing identifiers, which essentially means that camelCase is the same as snake_case. It's worth nothing that this does not make Nim more error-prone as some say, because Nim is fully statically compiled, so you can't mismatch an int variable for a string one. Furthermore, there is a compiler switch called styleCheck which can be used if you want to force programmers to use the same style as the symbol was declared with - see this comment