F() is a macro that instructs the compiler to store the string (an array of character bytes) that is passed as a parameter to the MC's flash memory instead of RAM.
This is a method for minimising the amount of RAM that a sketch needs.
Remember that the Arduino has a lot more flash memory that RAM. Therefore, for things like static (not changing) strings of text, it makes sense to store them in flash instead of RAM. RAM is better used for things like calculations or storing variables that change.
The things to remember when you use F() are:
- Only use it for small stings that do not change
- There is a small performance overhead, which in most cases is worth the savings in RAM
- It is not possible to optimise its use. I.e. If you have F("Hello") at two different parts of the sketch, the string "Hello" will occupy 5 bytes twice, that is 10 bytes in flash memory