# Undefined local variable or method \`city' for #\<Context:0x10099d8\>

**URL:** <https://www.ruby-forum.com/t/undefined-local-variable-or-method-city-for-context-0x10099d8/243618>\
**Category:** Ruby-Forum\
**Created:** [December 11, 2015, 7:10am UTC](https://www.ruby-forum.com/t/undefined-local-variable-or-method-city-for-context-0x10099d8/243618 "2015-12-11T07:10:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [December 11, 2015, 7:10am UTC](https://www.ruby-forum.com/t/undefined-local-variable-or-method-city-for-context-0x10099d8/243618/1 "2015-12-11T07:10:49Z")

</div>

first\_name = gets.chomp  
last\_name = city

undefined local variable or method `city’ for #Context:0x10099d8

What does “undefined local variable or method `city’ for  
#Context:0x10099d8” mean? Tried searching in Google, but no results  
were returned …

---

<div class="post-metadata">

**Author:** ![caigengyang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b782af/32.png) [@caigengyang](https://www.ruby-forum.com/u/caigengyang)\
**Post date:** [January 20, 2016, 9:21pm UTC](https://www.ruby-forum.com/t/undefined-local-variable-or-method-city-for-context-0x10099d8/243618/2 "2016-01-20T21:21:30Z")

</div>

It’s correct the message that return.  
What is city?  
Another variable or what?  
You must define city first and next you can associate to other variable.
