Language reference · section 31

31. Keywords

Reserved words cannot name a binding, a parameter, or a function. The list matches the lexer in crates/pin-compiler/src/lexer.rs.

Feature: Keywords

  Scenario: A reserved word cannot name a binding
    Given a reserved word such as try, catch, finally, yield, or break
    When the code uses it as a binding name
    Then the compiler reports an error

  Scenario: A reserved word can name a property after a dot
    Given the code "promise.catch(f)"
    Then the code is valid

Reserved words:

fn return if else while for in of const mut true false null and or not is isnt
when throw by class extends match from import export default async await yield
break try catch finally requires ensures assert then new

Words that have a meaning but are not reserved: