Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

igul222

macrumors newbie
Original poster
Nov 6, 2007
1
0
Hi. I'm new to Objective-C, and programming in general (I've been writing code for all of 6 days), and I noticed that an array or string created in one method or function is unavailable to me in another:

I'm not really surprised (from what I know, this is to be expected), but I'm still wondering how to get around the problem.
 

Attachments

  • error.jpg
    error.jpg
    23.2 KB · Views: 114

hankolerd

macrumors 6502
Sep 19, 2007
353
6
Seattle, WA
yeah, read up on it and see what you find.
essentially what it comes down to, is if you declare a variable inside a class and outside of functions, it can be used in any function in that class, if you declare a variable inside a function, it can be used anywhere in that function, and that function only(unless passed to a different function):apple:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.