exactly ! A variable that is declared outside a method is visible to that method, but not the other way round. All variables that are “outside” are done first, so calling on width will return its default value and size(x,y) will change these variables later.
@Aoyanco: “First” does not mean the order of lines in that case, but the hierarchy of things. You can write any variable anywhere in your code, if it is not inside a method (including) setup, it will be done before setup happens.