title: How to write this condition using guard let
body: <p>I want this condition using <code>guard let</code>.</p>
  
  <pre><code>if (self.fromLocation == nil || self.toLocation == nil) &amp;&amp; self.key.isEmpty {
      return
  }
  print("fromLocation and toLocation are not nil and key isn't empty") 
  </code></pre>
  
  <p>Initially I had</p>
  
  <pre><code>guard let fromLoc = self.fromLocation, let toLoc = self.toLocation else {
      return
  }
  print(fromLoc,toLoc)
  </code></pre>
  
  <p>Now I need to continue even if one or both <code>self.fromLocation,self.toLocation</code> are nil only if <code>key.isEmpty</code> is <code>false</code></p>
  
  <p>The above <code>if</code> condition works. But how can I write this using <code>guard let</code>?</p>
  
  <p><strong>Condition 1.</strong> If key is empty both from and to should be not nil</p>
  
  <p><strong>Condition 2.</strong> If key is not empty from and to can be nil </p>