• Post Reply Bookmark Topic Watch Topic
  • New Topic

Local variables  RSS feed

 
Ismael Upright
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Sierra's book there is a sentence:

Local variables are variables declared within a method.


[Sierra 53]


What about variables declared in a block of code? Aren't they considered as local also?
 
Kelvin Chenhao Lim
Ranch Hand
Posts: 513
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Local variables may be defined within a method, constructor, or initializer block.
 
Ismael Upright
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kelvin for your valuable help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!