DEV Community

Discussion on: under_scores, camelCase and PascalCase - The three naming conventions every programmer should be aware of

Collapse
 
juancarlospaco profile image
Juan Carlos • Edited

nim-lang.org is "Style Agnostic", AKA Style Insensitivity,
you can use Snake Case or Camel Case the way you like it.

var someVar, somePackage = "Camel Case"
echo some_var, some_package

var other_var, other_package = "Snake Case"
echo otherVar, otherPackage

var `kebab-case` = "Kebab Case"
echo `kebab-case`

var `for` = "Stropping allows to use Keywords as names"
echo `for`

type Cat = object  
var cat = "variable cat is not overwritten by Cat object"
echo Cat, cat

# echo prints to terminal (this is a comment)

## No name shadowing or overwriting here
## (This is a DocString, can be Markdown, ReSTructuredText or plain-text)

Its also for interoperability with other programming languages that may use different style,
eg. if you code Python with PyQt, it breaks the style beyond repair because everything is CamelCase on PyQt and everything is snake_case on Python.

Heres an Interactive Demo on the Nim Playground (click on RUN).
👑😎👍