title: Smalltalk variables: why should I declare them?
body: <p>Basically I can use variables just by assigning something to them, for example:</p>
  
  <pre><code>x := something
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>But in classes, if I define a new method, but I don't declare the variable, I get an "assignment to undeclared variable x", so I have to use:</p>
  
  <pre><code>|x| x := something
  </code></pre>
  
  <p>Why is this?</p>