Message Boards Message Boards

GROUPS:

What is wrong with these statements?

Posted 2 months ago
685 Views
|
9 Replies
|
0 Total Likes
|

What is wrong with the following statement? A="sedf" B="eret" shift-enter which asked for echo each statement. Perfect. But as I typed again A B The A is not assigned? But B is assigned Why? See the attached screen.

Attachment

Attachments:
9 Replies
Posted 2 months ago

I do not know.

enter image description here

Posted 1 month ago

I can surely do the alternative. But that does not answer my question. Can you do it as I did, (i.e. two assignment together) so that you are discussing my problem. Thanks.

Posted 1 month ago

Done with Mathematica V12:

enter image description here

I do not know whether there is a change regarding this subject among V11.2 and V12

In a notebook cell, remember to put a semicolon (;) at the end of each statement:

A = "abcdef"; (* <- semicolon *)
B = "cedfr"

Otherwise you may be rmultiplying:

FullForm[Hold[A = "abcdef"
     B = "cedfr"]]

(*  Hold[Set[A,Set[Times["abcdef",B],"cedfr"]]] *)
Posted 1 month ago

Why? I know semi-column. But, it is not necessary. If you do not want echo you put a semi-column. If you want it echo no semi-column. That is the rule I learnt.

My statements are not interpreted as multiplying. Suppose MATHEMATICA interpreted it as multiplying I won't get those two correct echos, i.e. A is not assigned but echoed, while B is assigned.

Is there anyway to debug my program? To see how does Mathematica interpret my statement? Perhaps, a FullForm?

I've just tried your example in a V11.3 notebook and it works as I'd expect - see below and attached. enter image description here

Not sure why your notebook is behaving as you've described. Can you attach it?

All the best,

Ian

Attachments:

Possibly a silly question, but did you evaluate your input cell 11 (the one containing just A)?

Posted 1 month ago

Thank you for your attention of my problem. I am using 11.2

I did not notice the notebook I posted did not evaluate A

This time I start the MATHEMATICA from the start manual it works. But there is a line below (assuming....) I do not understand what does that mean? enter image description here

Previously I clicked a xxx.m file to start the MATHEMATICA. Why? What is the difference?

Posted 1 month ago

The problem turns out to to be related to how did I entered those two command. If I entered by hand, no problem. If I loaded them from a .m file (clicking the .m file to start MATHEMATICA) there is a problem. Could anyone explain the problem?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract