What is the inline syntax for returning a value from an anonymous function?
<p>I've looked up numerous similar posts on StackOverflow, but they don't seem to come close to my issue as my lambda is within a Coroutine.</p>

<p>My code :</p>

<pre><code>public string FetchInternetItems()
    {

      WWW www = new WWW(someURL);

      StartCoroutine(WaitForRequest(www, callback =&gt; {

      if(!string.IsNullOrEmpty(callback))
      {
        Debug.Log("Successfully worked..");
      }
      else
      {
        return "Did not connect to remote server.";
      }

      }));
</code></pre>

<p>Excerpt from <code>WaitForRequest</code> :</p>

<pre><code>IEnumerator WaitForRequest(WWW www, Action&lt;string&gt; callback)
    {
        yield return www;

        if (string.IsNullOrEmpty(www.error))
        {
            if (callback != null)
            {
              callback(www.text);
            }
        }
        else
        {   
            Debug.Log("WWW Error: " + www.error);
        }
    }
</code></pre>

<p>Coroutine class can be found here : <a href="https://docs.unity3d.com/ScriptReference/MonoBehaviour.StartCoroutine.html" rel="nofollow">https://docs.unity3d.com/ScriptReference/MonoBehaviour.StartCoroutine.html</a></p>

<p>Which returns the error : </p>

<pre><code>Anonymous function converted to a void returning delegate cannot return a value
</code></pre>

<p>Ideally, I would like it to return the <code>callback</code>, unless nothing came through, and instead return the <code>Did not connect to remote server.</code> message.</p>