Challenge: Coroutine Scope Functions

Solve a challenge regarding coroutine scope functions.

We'll cover the following

Problem

Write a suspend test function using withTimeout that will time out after 1.4 seconds, and where the body of the test function will print “Educative” after 1 second and “Inc.” after 1 second.

Restriction

The output will be available in the terminal.

Output

The output will be as follows; here, we’ll see a delay of 1 second.

Educative
Cancelled

Get hands-on with 1200+ tech skills courses.