Is there any better way to replace the repeating if-statements?

Hi everyone. Here is my original steps sample. For example, the shortcuts will get the current time and check if time is during morning, 'Good Morning!' will be shown. Else if it is during afternoon, 'Good Afternoon!' will be shown. And Else if it is evening, 'Good Evening!' will be shown. And finally else if it is midnight, 'Good Night!' will be shown.

I think this method is quite verbose if I would like to do something similar in more detail and complicated shortcut in the future. So I would like to ask if there is any better way to do the same things. For example by using dictionary (which I don't quite understand the rationale) ? Look forward to your reply. :)