Skip to main content
24-Ruby IV
April 17, 2016
Solved

swap in Mathcad

  • April 17, 2016
  • 3 replies
  • 2290 views

Can we have in Mathcad same statement?

a:=1

b:=2

swap(a, b)

a=2

b=1

Best answer by ValeryOchkov

3 replies

23-Emerald IV
April 17, 2016

sort of:

Success!
Luc

ValeryOchkov24-Ruby IVAuthorAnswer
24-Ruby IV
April 18, 2016

25-Diamond I
April 17, 2016

This would be inconsistent as it would be the first and only Mathcad command which directly operates on and changes worksheet variables without using an assignment. After all, Mathcads progranmming does not support passing function arguments by reference, just call by value.

And Lucs swap-routine is easy enough to write anyway.

But maybe there is a way to do it the way you want using scipted components. Just give it a try and let us know.

24-Ruby IV
May 1, 2016