title: I want to return Boolean after firebase code is executed
body: <p>I'm retrieving data from Firebase Google. I'm checking the data i received is expire or not.</p>
  
  <pre><code>func checkBought(movieName : String) -&gt; Bool{
  
      var yesOrNo = false
  
      boughtRef.observeEventType(.Value, withBlock: { (snap) in
  
          if snap.value![movieName]! != nil {
              if self.timestamp &gt; snap.value![movieName]! as! Double {
                  //expire
                  print("expire")
                  yesOrNo = false
              } else {
                  //not expire
                  print("not expire")
                  yesOrNo = true
              }
          } else {
              //not bought yet
              print("No movie")
              yesOrNo = false
  
          }
      })
  
      return yesOrNo
  }
  </code></pre>
  
  <p>Now, the return statement is returning before the firebase code is executed and change the value of yesOrNo.</p>