title: Initializing a new string
body: <p>this is a beginner question.
  I needed a new string variable today, so I did something like this:</p>
  
  <pre><code>NSString* newString = nil;
  if(something)
  newString = @"a value";
  else
  newString = @"different value";
  </code></pre>
  
  <p>and it worked just fine. Still, I do know a little about memory allocation, and I feared this might cause problems somehow, so I changed in the end the code to:</p>
  
  <pre><code>NSString* newString = [NSString stringWithFormat:@""];
  if(something) ...
  </code></pre>
  
  <p>Is it a bad practice what I previously did? 
  I know some variables get allocated automatically, so you don't need to call alloc for them, but wouldn't initializing them as nil work just as well?
  I'm sorry if this question sounds silly, I came to objective-c from php and my knowledge about memory management is close to.. nil</p>
  
  <p>[<strong>edit</strong>]
  This is not a question about nil vs @"";
  My question is if it's ok to simply use a <code>NSString = something</code> (nil, @"", @"a value") and if, in general, it's ok to do this for objects.
  For example, instead of doing a <code>NSRandomObject = [[NSRandomObject* alloc] init];</code> I can simply do <code>NSRandomObject = aValue;</code></p>