Hi,
Welcome to the forum!
Which code editor are your students using? Do they use the p5 web editor?
Because depending on the IDE, there might be functionalities to hide comments :
-
This is still open on VSCode : https://github.com/microsoft/vscode/issues/46505
-
For Sublime : How to hide comments - Technical Support - Sublime Forum
-
On JetBrains products (collapse doc strings): Is there any way to collapse just comments? – IDEs Support (IntelliJ Platform) | JetBrains
-
Atom : fold-comments
-
Brackets: GitHub - thehogfather/brackets-code-folding: Code folding extension for brackets IDE
And in the p5 web editor, you can fold functions, blocks and multiline comments but not single line comments. Feel free to open an issue on GitHub for a feature enhancement :