Contents

Roo

Identifiers

An identifier is the term given to the name you assign to one of the following constructs:

  • A variable
  • A function
  • A class
  • A module

Identifiers are case-sensitive. They may start with an underscore (_), lowercase a-z or uppercase A-Z. They may contain underscores, upper or lowercase letters a-z or digits. They may end with either ! or ?. The following are examples of valid and invalid identifiers:

# Valid.
name
_my_variable
hero1
shout!

# Invalid.
1stop # Starts with a digit.
๐Ÿ˜€ # Roo dislikes Emoji.

Style guide

Whilst you are free to style your identifiers however you wish, itโ€™s suggested that the following format is used:

  • Class and module names should begin with capital letters (e.g: File) and be CamelCased
  • Functions should begin with lowercase letters and use snake_case (e.g: increase_score())
  • Functions and methods that return a Boolean should end with ? (e.g: has_paid?())
  • Methods that are destructive to the object they belong to should end with ! (e.g. capitalise!)
  • Variables that are intended to be private should start with an underscore (e.g: _counter)