Other than in ordinary C / C++ , the Arduino IDE allows to call a function before it is defined.

In .cpp files, you have to define the function, or at least declare the function prototype before you can use it.
In an .ino file, the Arduino IDE creates such a prototype behind the scenes.

Arduino - function declaration - official