Happy Coding

Question on Void Function

I was studying some code and I came across this

void some_name (writing inside the small brackets){
}

I don’t get what the text inside the small brackets would mean, is it just a description?

Those are called parameters or arguments and they allow you to give more information to the function.

I wrote more about that here:

For example, let’s say you wanted to create a function that prints out somebody’s first and last name. You might do this:

void printHello(String firstName, String lastName) {
  println("Hello " + firstName + " " + lastName);
}

And then when you call that function, you’d pass in the arguments the function needs:

printHello("Ada", "Lovelace");
1 Like

Oh, now I get it.
Silly me, I should have known that.