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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Local Assignment Operator in a Program

andmail
1-Newbie

Local Assignment Operator in a Program

Is it bug or not?

0.jpg1.jpg

16 REPLIES 16
MikeArmstrong
5-Regular Member
(To:andmail)

A few comments in the attached sheet.

Mike

Thank you for your quick reply. But I mean why do I have to define "c" in my last program 2 times? In worksheet and in program? Without it I can not get the right result. I think it would be right to define "c" one time in worksheet, isn't it?

MikeArmstrong
5-Regular Member
(To:andmail)

It must be a bug, see below.

Clipboard01.jpg

Mike

An alternative method, see attached.

Mike

Thank you but my real task is looking like this:

3.jpg

it gives a correct result with the first (extra) line of the program... without it h0 = 0 inside program!!!!!!

PS: h0 has defined in worksheet above program

MikeArmstrong
5-Regular Member
(To:andmail)

So have you got your solution now?

Mike

Yes! I've got my solution, but my question was "is it bug or not?" I mean defining the same variable (h0 in my examle) 2 (two) times. Is it right that a variable defined in worksheet before program is ZERO inside program???

MikeArmstrong
5-Regular Member
(To:andmail)

Is it right that a variable defined in worksheet before program is ZERO inside program???

It's not see below. Wayne has given a good description of locally defined variables and variables defined at worksheet level.

Clipboard01.jpg

Mike

wayne
3-Visitor
(To:andmail)

I see, there is a bug, a rather nasty Boolean Bug.

I normally use argument lists, for which it works correctly, so havn't seen this

wayne
3-Visitor
(To:andmail)

In addition to Mike's example, perhaps the following will help

Variables assigned outside and prior to a program definition are available inside a program.
Variables assigned inside a program are available inside the program only.

If you redefine c inside a program, it has that value in the program only, it does not effect the value outside the program, which is really good.

andmail
1-Newbie
(To:wayne)

Thank you, I know about this form MC help. Look at my previouse post

So, is this thread is a bug report, or not? It would be great to correct this bug

For simple understanding:

1.jpg

Form MC help:

Local variables or functions defined with this operator may be assigned to values from the worksheet. For example, it's possible to define a:=2 in your worksheet, then define a local variable b ← a inside a program.

Mathcad 15.0 (M010 [MC15_M010_20110622])

PS: Does this bug manifests in other versions of MC? I do not know, because I've just begin to use MathCAD.

MikeArmstrong
5-Regular Member
(To:andmail)

I would suggest upgrading your to the latest version of M15.

Mike

I think he wrote he is using M010 which as far as I know ist the latest version, isn't it

WR

MikeArmstrong
5-Regular Member
(To:rag)

I think he wrote he is using M010 which as far as I know ist the latest version, isn't it

Good spot, my bad.

Mike

Anyway, the next service release M020 is scheduled by PTC for Q2 2012.

Top Tags