title: How can I return an awaited value in Kotlin?
body: <p>I need <code>test()</code> to return a player from my db.  I know I can use a callback but how can I make this work with <code>async</code> <code>await</code>?</p>
  
  <pre><code>fun test(): Player {
      launch(UI) {
          val player = async(CommonPool) { MainActivity.database?.playerDao()!!.loadPlayer() }.await()
          return player
      }
  }
  </code></pre>
  
  <p>Currently the error is <code>return is not allowed here</code></p>
  
  <p>In <code>JavaScript</code> for example I would make <code>test</code> <code>async</code> then <code>await</code> it's result from where it's called.</p>