cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Comments on programming lines

azikorus-disabl
1-Newbie

Comments on programming lines

Collab,

Is it possible to add text comments on programming lines? I thought that I've seen this done but can't see how to do it. I tried ,"initial value" following a variable definition but this did not work?

Thanks,

Art
32 REPLIES 32

On 11/28/2004 3:56:12 PM, ArtZ wrote:
==Is it possible to add text comments on programming lines? I thought that I've seen this done but can't see how to do it. I tried ,"initial value" following a variable definition but this did not work?

In the absence of Valery, Tom and Richard, inter alia, is the attached of any help?

Stuart


Stuart,

Did you forget to attach something?

Art

On 11/28/2004 5:50:17 PM, ArtZ wrote:
>Stuart,
>
>Did you forget to attach something?

Duh! My brain?

RichardJ
19-Tanzanite
(To:StuartBruff)

On 11/28/2004 5:34:00 PM, stuartafbruff wrote:

>inter alia

Cor, latin! ewe must bee edukated! I had two looc that upp! Butt mi diktonari sais it meens "among other things", so I thinc yoor youasge is knot quite rite 🙂

Robert posted a worksheet here:

http://collab.mathsoft.com/read?61353,12

that shows two methods of commenting programs. Personally, I like the simple string. The colored comments are nice, but I don't like the extra garbage hanging off the end of each line.

Richard
StuartBruff
23-Emerald II
(To:RichardJ)

On 11/28/2004 6:57:33 PM, rijackson wrote:
>inter alia
==Cor, latin! ewe must bee edukated!

Me? Educated? I think the National Union of Teachers will sue for that kind of slur on their reputation! More likely to be a habit aquired dealing with solicitors 😐

==I had two looc that upp! Butt mi diktonari sais it meens "among other things", so I thinc yoor youasge is knot quite rite 🙂

Denuone Latine loquebar? Me ineptum, interdum modo elabitur.

That's what happens when I try to write things off the top of my head. I thought the translation was 'amongst others' .. without the ' thing' bit. Should it have been 'alii'? Got any Latin experts out there?

==Robert posted a worksheet here:
== http://collab.mathsoft.com/read?61353,12
==that shows two methods of commenting programs. ==Personally, I like the simple string. The colored comments are nice, but I don't like the extra garbage hanging off the end of each line.

I'd forgotten about that one. If you see any stray neurons out there, they're mine!

However, the start of the thread does suggest an additional benefit of Worksheet level looping constructs; highlighting changes to code.

Stuart
RichardJ
19-Tanzanite
(To:StuartBruff)

On 11/28/2004 8:16:22 PM, stuartafbruff wrote:



>Denuone Latine loquebar? Me ineptum,

>interdum modo elabitur.

Neutiquam erro

OK. I admit it. I lied. I had to look that up too.

Richard
StuartBruff
23-Emerald II
(To:RichardJ)

On 11/28/2004 9:29:36 PM, rijackson wrote:

==Neutiquam erro

==OK. I admit it. I lied. I had to look that up too.

Same here 🙂

Di! Ecce hora! Uxor mea me necabit!

Stuart

Folks,

I tried all the methods for adding comments on the same line and I always get red, i.e., there is a problem.

Also, in the example file, why do the <--- change to = when the comments are added?

Art

On 11/28/2004 9:10:57 PM, ArtZ wrote:
On 11/28/2004 9:10:57 PM, ArtZ wrote:
==I tried all the methods for adding comments on the same line and I always get red, i.e., there is a problem.
== Also, in the example file, why do the <--- change to = when the comments are added?

Art,

a. what version are you using?
b. could you please post an example of your comments?

Stuart

Stuart,

This the worksheet I am trying to add comments to.

Art

The comment has to be on it's own line. There is no way I know of to add a comment to line that actually does something.

Richard
RichardJ
19-Tanzanite
(To:RichardJ)

On 11/28/2004 9:39:42 PM, rijackson wrote:
>The comment has to be on it's
>own line. There is no way I
>know of to add a comment to
>line that actually does
>something.

I just looked at Stuart's worksheet. I guess I just learnt something!

Nice trick Stuart. Here's my variation on it. Painful to write a long program this way though!

Richard





StuartBruff
23-Emerald II
(To:RichardJ)

On 11/28/2004 10:03:30 PM, rijackson wrote:
==Here's my variation on it. Painful to write a long program this way though!

Neat, Richard! You can take some of the pain out of it by:

entering the "x f y" infix operator, then the blank, then quote marks.

Copy this template and paste it into a blank line whenever you want an inline comment.

Stuart

infix makes the C++ style look a little better, as well

Only thing I would suggest is making the function f(a,b):=a, rather than multiplying a by a one generated the hard way. There is no requirement that a function use all, or any, of its arguments.

Tom Gutman
StuartBruff
23-Emerald II
(To:TomGutman)

On 11/29/2004 3:20:51 AM, Tom_Gutman wrote:
==Only thing I would suggest is making the function f(a,b):=a, rather than multiplying a by a one generated the hard way. There is no requirement that a function use all, or any, of its arguments.

Good Point.
RichardJ
19-Tanzanite
(To:TomGutman)

Right. Should have thought of that.

Richard

On 11/28/2004 9:32:28 PM, ArtZ wrote:

>This the worksheet I am trying to add comments to.

Art,

Your closing parenthesis is inside the quotation marks and you need to put the '(s):=IsString(s) definition in.

Stuart


Stuart,

It's very strange but if I open the worksheet that you modified, the comment is OK. If I type in or copy and paste the comment that you created into my original worksheet, the ` turns red and the program fails to operate. What am I missing?

Art

On 11/29/2004 9:29:44 AM, ArtZ wrote:
It's very strange but if I open the worksheet that you modified, the comment is OK. If I type in or copy and paste the comment that you created into my original worksheet, the ` turns red and the program fails to operate. What am I missing?

Art,

Have you copied the definition of the function ' across?

'(s):=IsString(s)

or the infix Jackson-Gutman method

'(x,s):=x

used in a program, eg

s<-3 ' "assign 3 to s"

Stuart


Stuart et al,

Thanks, I got it. Just seems a bit arcane.

Art

On 11/28/2004 9:10:57 PM, ArtZ wrote:
>Folks,
>
>I tried all the methods for
>adding comments on the same
>line and I always get red,
>i.e., there is a problem.

As Stuart says, post your worksheet.

>Also, in the example file, why
>do the <--- change to = when
>the comments are added?

"Tools", "Worksheet Options", "Display". All will be clear.

Di! Ecce hora! Uxor mea me necabit!

Richard

Richard,

Watch out for your wife! Yes, I see the display options. So, why can't I put a comment on the same line as a variable definition? I swear tha tI've seen it on somebody's worksheet but can't find it.

Art
StuartBruff
23-Emerald II
(To:RichardJ)

On 11/28/2004 9:34:47 PM, rijackson wrote:

>Di! Ecce hora! Uxor mea me necabit!

🙂 I hadn't seen your email when I replied!

Stuart

RichardJ
19-Tanzanite
(To:StuartBruff)

Credo nos in fluctu eodem esse!

Richard

I often see the expression "et al." Now, I can quess from French that "et" is "and". But this guy Al must be everywhere. Al Gore perhaps?
RichardJ
19-Tanzanite
(To:ptc-3260442)

Al Bundy, I think.

Richard

See the Fig 1.50 from the book "Mathcad 12 for students & Engineers" (in Russian - ready, in English - in work):

Valery Ochkov
http://twt.mpei.ac.ru/ochkov

It is possible in this way:

 

You press " and it will aappear a square where you add "your desired comment".   You write the comment ------> right mouse click at the begining of the COMMENT ------->> choose INSERT MATH REGION ---------> you will write the necessary math equation that will be active for the next equations that will depend on it.

 

tubar_1-1591654583308.png

 

 

 

 

 

 

LucMeekes
23-Emerald II
(To:tubar)

That is a comment on a sheet expression, which is standard mathcad functionality.

However the original question was about comments in a program (programmed function). In that case you can enter a string on a program line, but you cannot embed a math expression into that string.

 

Luc

Announcements