Identifiers

Identifiers are user-defined names that can refer to literals, other identifiers, or functions.

Identifiers must start with a letter (a through z inclusive, upper or lower case). After the first character, letters, numbers, and _’s may be used.

Examples of valid identifiers:
  • a
  • A7
  • my_variable
Examples of invalid identifiers:
  • 8abcd (must begin with a letter)
  • my_invalid-function (must use only letters and _'s)
The following keywords are reserved by the language and cannot be used as identifiers:
  • function
  • return
  • end (this is a special case and can be used as a function in certain circumstances)
  • for
  • while
  • break
  • if
  • elseif
  • else
  • global
  • otherwise
  • persistent
  • switch
  • case
  • try
  • catch
  • classdef
  • continue

Not all of these keywords are supported in OML, but they are reserved for future use.