Fiber
A Fibers (or coroutine as called in other languages) are special functions that can be interrupted at any time by the user. When a conventional function is invoked, execution begins at the start, and once a function exits, it is finished. By contrast, Fibers can exit by calling other Fibers, which may later return to the point where they were invoked in the original coroutine:
func main() {
var fiber = Fiber.create({
System.print("fiber 1");
Fiber.yield()
System.print("fiber 2");
});
System.print("main 1");
fiber()
System.print("main 2");
fiber()
System.print("main 3");
}
// Output:
// main 1
// fiber 1
// main 2
// fiber 2
// main 3
TO DO: more explanations and examples