Logo

Programming-Idioms

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

Idiom #3 Create a procedure

Like a function which doesn't return any value, thus has only side effects (e.g. Print to standard output)

-spec procedure() -> _.
procedure() -> io:format("#YOLO!~n").

There is no way to avoid returning a value here. This function returns ok. But you can add -spec to say that you should not care about the result.
procedure Finish (Name : String) is
begin
   Put_Line ("My job here is done. Goodbye " & Name);
end Finish;

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