Logo

Programming-Idioms

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

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)

interface F { void set(); }
F f = () -> out.println("abc");
f.set();
void f() { out.println("abc"); }
private void methodName() {
	System.out.println("Hello, World!");
}
void finish(String name){
  System.out.println("My job here is done. Goodbye " + name);
}

void means "no return value".
procedure Finish (Name : String) is
begin
   Put_Line ("My job here is done. Goodbye " & Name);
end Finish;

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