Reserved Words

Words that cannot be used as identifiers.


Complete List

The following words are reserved and cannot be used as variable names, function names, player names, or strategy names:

and        class      else       false      for
fun        game       if         nil        or
payoff     players    print      return     solve
strategies super      this       true       using
var        while

Future Reserved Words

These words may be reserved in future versions:

break      continue   import     export     
match      case       enum       struct
async      await      yield      from

Using these as identifiers is discouraged.


Valid Identifiers

Identifiers must:

  • Start with a letter (a-z, A-Z) or underscore (_)
  • Contain only letters, digits (0-9), or underscores
  • Not be a reserved word

Examples

IdentifierValid?
player1Yes
_privateYes
MyGameYes
nash_equilibriumYes
1stPlayerNo (starts with digit)
player-oneNo (hyphen not allowed)
classNo (reserved word)
printNo (reserved word)

Naming Conventions

ElementConventionExample
VariablescamelCasemyScore
FunctionscamelCasecalculatePayoff
ClassesPascalCaseGameSolver
GamesPascalCasePrisonersDilemma
PlayersPascalCaseAlice, Firm1
StrategiesPascalCaseCooperate, Defect
ConstantsUPPER_SNAKEMAX_ROUNDS