Putting your computer to sleep will allow you to quickly find your work in progress. It is recommended to use it for a short time, a lunch break, a meeting... and to turn it off when the duration is longer.
Windows
Please follow this short tutorial if you want to set the conditions of your screen sleep.
You are free to choose under which condition your screen will go to sleep.
MacOS
To set the sleep rules on a MacBook, please go to Apple menu > System Preferences, then click on Power Saver.
A list of sleep conditions for your computer will appear. Select the options that suit you.