Update to Windows 10: What is going to happen to my data and apps?
The Preview allows you to retain your settings, files and apps, and the final version will too:
Of course having a backup is prudent as with any such major upgrade.
According to This Article, you will be able to run an in-place upgrade which will keep all of your personal data.
During the install, you will be given the option to keep all your data and settings, keep you rdata only or bin the lot.
Anything older than Windows 7 will require a complete format of your machine during which you will lose everything as evidensed by this screenshot:
Of course, with this being a complete OS upgrade - things could go wrong, so it is always advised to take a backup of your machine first and ensure that all your personal files/data are copied off the machine onto another computer/external disk/nas