---
The Coroutine syntax draft
It would be auto add the Swoole Coroutine statements when used Coroutines
---

#main

#php usleep(micro_seconds UInt)

internal LOOP_TIMES = 9

internal co_test() {
	// declare and initialize an Array type Channel variable
	var chan = Array.Chan()

	var count = 0

	// produce data
	// use #co to create a Coroutine
	#co for i = 1 to LOOP_TIMES {
		for j = 1 to LOOP_TIMES {
			// usleep would be hooked by Swoole, and became to Coroutine inside mode
			usleep(1000)

			// currently in the process of Coroutine, that's an async mode
			message = [count, i, j]

			// send data to the Channel
			chan[] = message

			count += 1
		}
	}

	// consume data
	#co while true {
		usleep(100000)

		// receive data from the Channel
		// it would be infered to Array type
		received = []chan

		var_dump(received)
	}

	echo 'the Coroutine running...'
}

co_test()

usleep(300000)

// end
