A static function is a function that only runs calculations on its inputs and returns a value. It is bound to a class rather than an object (an instance of that class).
This means that static functions don't have access to the properties of the class, which only exist on instances. This doesn't sound too useful, does it?
Well, the good news is, you can call a static function without creating an instance of the class! They're great for utility functions that don't need to know anything about the class they're in.
You could use static functions for things like:
Math calculations (geometry, physics, etc.)
Generating data for procedural levels
Listing all the files in a directory
Processing and modifying text
And more.
To define a static function in GDScript, you use the static keyword before the function definition. Here's an example of a function that finds all the files with a specific file extension in a directory (".png", ".mp3", etc.):