Forum Discussion

amanjainits's avatar
amanjainits
Copper Contributor
Feb 26, 2022

Async and Await Query

Why the output is like this
123
XYZ
as per my understanding, it should print XYZ first, as I am not writing await in line no. 50

 

1 Reply

  • svick's avatar
    svick
    Copper Contributor

    The method Test is not async, which means it will block the current thread while waiting. And since that method is invokes before any await, that is the same thread as the one that executes PrintData, which means Test is effectively blocking PrintData.

Resources