Skip to content

Procedures

A procedure is a group of instructions that do something. In your program, you can define your own procedures, allowing you to divide a program’s tasks into separate steps.

Annotated sample code showing a procedure declaration

Example

The following shows an example of a say_hello_to procedure, which is called from the main function.

#include "splashkit.h"
/**
* Output a message to say hello to a give user name.
*
* @param name The name to say hello to
*/
void say_hello_to(string name)
{
write_line("Hello " + name);
}
int main()
{
say_hello_to("Bob");
say_hello_to("Alexis");
// etc...
return 0;
}