Try to run your code from the tool bar as shown below :
In your code, if you have more than one function then, before running it you should mention the function you want to run with. For example :
Alternatively, you can press ctrl + r from your keyboard to run the code. It will save the code first, if not saved, and then run it. But, for that to work, you must have selected the function, as seen in the image above.
Also, if your script is called by some external activities, still you will be able to see logs by clicking view->logs if you are logging anything after the code is executed.