I wanted to "comment" some code so the input inside (* *) is ignored.

I tried this but the last term z[3] looks like it is not commented.

 (* z[1]=1; z[2]=2; z[3]=3; *) 

mathematica editor

How to rectify this?

I know it is a simple question, but I didn't find the answer to this.

  • 1
    $\begingroup$ I'd say that it is not expected but there are known problems with syntax highlighting, usually can be fixed by cut+paste or adding a space here and there. Btw, it seems that is not a standard stylesheet, which one it that? $\endgroup$ – Kuba Jul 18 at 6:46
  • $\begingroup$ I used default style sheet but I have changed the background color to light green $\endgroup$ – acoustics Jul 18 at 7:07

Your comments are fine, if in doubt always check the FullForm of the expresion. The problem is only in the syntax highlighting, that has been far from perfect in most version.

FullForm[(*z[1]=1;z[2]=2;z[3]=3;*) z]
(* z *)

As this is a bug, you may avoid it but not rectify this problem unless Wolfram releases a patched version of Mathematica. Next time it happens take a screenshot go to Help > Give feedback, and fill a report to Wolfram Support.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.