There exist two types of computer shutdown method, the HARD and SOFT. For your curiosity, the latter is the best practice. This feature is only applicable for ATX form factor power supply unit. (Pentium 3 and above power supply unit)
Dangerous method: HARD Shutdown
A HARD Shutdown is the method used by pressing the power button for roughly 5 seconds, then the computer will power off regardless of anything running. Just like plugging out the power socket !
Beware of this method because computer hardware could be damage !
Therefore please use a SOFT shutdown in which is the reverse of what is explained above.....that is by pressing the power button just once and leave your finger from the power button within 5 seconds! All software in the CPU process cycle shall be close in an orderly fashion. Computer hardware is safe from damages.