Consider `def obj.talk`. Ruby recognizes `def` as a keyword that starts a method definition. `obj` and `talk` play different roles: one identifies the object, and the other names the method being defined. A keyword is a reserved word with a designated syntactic role, not a variable name. section 2.1.2 section 2.5.4
When Ruby encounters a bare word, it first checks whether the word is a keyword. Otherwise, `=` can mark a local-variable assignment, and following parentheses identify a method call. Without either clue, Ruby tries to resolve the word as a local variable or method call. An unresolved `x` therefore produces an error naming both possibilities. section 2.5.4
Keywords appear in several kinds of construct:
- `def` starts a method definition; `class` starts a class definition. section 2.1.2 section 3.1
- `if` begins a conditional clause. `true` and `false` are reserved terms that also denote Boolean objects. section 2.5.4 section 7.5.2
$ ruby -e "x"
-e:1:in `<main>': undefined local variable or method 'x'
➥for main:Object (NameError))
The error for bare `x` illustrates why distinguishing keywords from local variables and method calls matters. section 2.5.4


