Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #93 Pass a runnable procedure as parameter

Implement the procedure control which receives one parameter f, and runs f.

func control(f func()) {
	f()
}

Go supports first class functions, higher-order functions, user-defined function types, function literals, and closures.
procedure Control (F : access procedure) is
begin
   F.all;
end Control;

New implementation...
< >
programming-idioms.org