Question about mathematics commands

  • Thread starter Thread starter raymound
  • Start date Start date
  • Tags Tags
    Mathematics
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 2K views
raymound
Messages
13
Reaction score
0
hi
I was going to ask if there's a way to command mathematica not to run a sentence or a part of a sentence as "//" works in php and "!" in fortran
 
Physics news on Phys.org
You mean comment out a line?

(* This is a Mathematica comment *)
 
yes,
is that the only way
isn't there any syntax like the ones in fortran or php?
 
I don't think I follow...

This is a command // remove this bit in PHP (or C++)
This is a command ! remove this bit in Fortran
This is a command (* remove this bit in Mathematica *)
This is a command /* remove this bit in C */

The start and end braces mean you can have it mid-line, whereas the // and ! assume you mean 'comment out to the end of the line'.

a = b + c (* + d *) + e

will give you a = b + c + e
 
If the material you want to comment out is in a separate cell, or you position the cursor and divide the cell with <shift><ctrl>d to put the material in a separate cell, then you change the cell properties and make that a text cell or a Section cell or a SubSection cell or any other kind of cell that isn't evaluated.

Later you can merge the cells back together by selecting the desired cells and merging with <shift><ctrl>m

This would not be appropriate for some things.

Or... something perhaps much less appropriate. What if you picked one of the otherwise unused characters, defined it to be an operator, which is really just a function, set the attributes so that it would not evaluate any arguments and had the operator return Null. I am not certain all this could be done or that this would be a good idea.