title: "if" statement doesn't work properly?
body: <p>I have made a custom keyboard in my app. When user presses spacebar, this code runs:</p>
  
  <pre><code>NSString *lastChar = [myTextField.text substringFromIndex:[myTextField.text length] -  1];
  
  NSLog(@"lastChar is `%@`", lastChar);
  
  if (lastChar != @" ")
  {
     NSString *currentString = [NSString stringWithFormat:@"%@ ", myTextField.text];
     [myTextField setText:currentString];
  }
  </code></pre>
  
  <p>And I make a check, if last symbol that user used was <code>space</code>, he won't be able to use it again
  (no need in my case). However, the code under the <code>if statement</code> still runing. So I've made a check with <code>NSLog</code>, and even if the last char was <code>space</code>, the code under the <code>if statement</code> executes. How does it happen? 
  Can somebody point me on my foolish mistake? 
  Thanks in advance.</p>
  
  <p><strong>UPDATE:</strong>
  Sorry, I always forget how to compare strings in Objective-C, I've already flagged the question, thank you everyone for your anwsers.</p>