I'm aware that I can use (* ... *) to comment out stuff. Is there a way to quickly comment out just one line without paired comment chars?
|
|
|||||||||||||
|
|
There is no way to comment out a single line. Mathematica doesn't really respect lines, it pushes working at the expression level when possible (not at the source text level). Converting cells between different forms (StandardForm, InputForm) will even shuffle around newlines. Copying and pasting code does the same. As @acl has menioned, you can select a piece of code and comment it out with Alt-/. The shortcut Ctrl-. makes it easy to select subparts of expressions. These commands are found in the Edit menu (mentioning in case the keyboard shortcut is different on other platforms). I am not advocating this behaviour, just explaining the current situation. |
|||||||||||||
|
|
Also, for the mouse-oriented user, you can select an expression, call up the context menu by right mouse click and choose "Un/Comment". |
|||
|
|
|
Actually, you can comment-out a line that doesn't form a complete expression. For example, in
select the entire first line by dragging the mouse over it. Then press Cmd+/ (on a Mac) and the first line will be commented out -- leaving, of course, a syntax error showing on the uncommented 2nd line. |
||||
|
|
|
To "comment out" a complete cell you also can just make it non-evaluatable: Select the cell and use the menu checkbox item "Cell|Cell Properties|Evaluatable". |
|||
|
|

