Trying to learn how to code Sketches

First, it's called the setup function. Void is simply the return type.

Outside of the setup function is the global scope, so any global variables should be declared there (and initialized, if necessary). The setup function should contain things like object begin or start methods, pinMode or anything that requires the hardware to have been initialized.