Posted to tcl by pooryorick at Thu Apr 05 13:05:04 GMT 2018view pretty

coroutine c1 ::apply [list {} {
	yield
	puts {hello from c1}
	main
}]
coroutine main ::apply [list {} {
	catch {[yieldto c1]} cres copts
	puts {goodbye from main}
	puts [list cres is $cres]
}]