+ 1
WRITE A PROGRAM TO EXECUTE COMMENTS .
how to execute comments
8 Answers
+ 6
Execute comments? You don't; they're comments because the compiler ignores them knowing that they're nothing more than comments for mere mortal humans.
However, I believe you have a real problem you're trying to solve, but simply asking the wrong question. What is your problem that you're trying to figure out? We can help you out with it.
+ 5
Comments aren't something that gets compiled, as its purpose is simply for human documentation and nothing to do with the program's functionality. Even with something like JAVADOC, you're not executing comments, you're executing JAVADOC. Even if you placed what -looks- like a comment in a print function and use escape chars, you're not executing comments, you're executing a print statement to display what looks like a comment, but it isn't a comment, it's just a string.
However, I'm hardly always right, and I've much to learn still, so please elaborate and explain how you do it.
+ 3
The concept... extract a 'helper script' or template from your own script, stored in a multi-line preserving format.
This is the pattern of a "here" document or script (for data or code):
(just examine the initial description and jump to the Python section for the concept, because the rest of the syntax discussion may confuse the idea):
https://en.m.wikipedia.org/wiki/Here_document
https://en.wikipedia.org/wiki/Here_document#Python
A slight modification to the concept repurposes the JS script tag:
<script id="..." type="javascript/worker">
// This here-like-script is ignored by the parser
</script>
My point is, it is a developer pattern (at least in multi-line form)...I actually use it in several codes (gpu, workers, data).
+ 2
One of the weirder programs I've written.
https://code.sololearn.com/WiV9WE6gvvl6/?ref=app
EDIT: Netkos is right of course, don't ever do this. In most languages you can't, anyway. Maybe you are talking about annotations?
+ 1
In python docstring acts as multiline comments, but will be read by program. So, can be used as input or output...
+ 1
okay now. it's an accidental discovery by the way. try typing \u000d after //. well it worked in the ide. I'm experiencing some problems in command prompt
+ 1
and that's what I'm asking. sry, I didn't explain clearly in the question. any ideas as to how to do it in command prompt?
0
u sure? coz comments CAN be executed