Simple solution with channels | Golang
Approach\nAfter printing foo wait while bar is printed and the other way around. For this purpose we use a channel with zero capacity. Bar and Foo send a value 
# Approach\nAfter printing `foo` wait while `bar` is printed and the other way around. For this purpose we use a channel with zero capacity. `Bar` and `Foo` send a value to the channel, than wait for a feedback from each other.\n\n# Code\n```\ntype FooBar struct {\n\tn int\n    ch chan int\n}\n\nfunc NewFooBar(n int) *FooBar {\n\treturn &FooBar{\n        n: n,\n        ch: make(chan int),\n    }\n}\n\nfunc (fb *FooBar) Foo(printFoo func()) {\n\tfor i := 0; i < fb.n; i++ {\n        // printFoo() outputs "foo". Do not change or remove this line.\n        printFoo()\n        fb.ch <- 0\n        <-fb.ch\n\t}\n}\n\nfunc (fb *FooBar) Bar(printBar func()) {\n\tfor i := 0; i < fb.n; i++ {\n        <-fb.ch\n        // printBar() outputs "bar". Do not change or remove this line.\n        printBar()\n        fb.ch <- 0\n\t}\n}\n```
['Go']