Also note that the two examples above should be used if need to use the two variables at the same time for different thing. Your example works fine if you just need to use it once and then change the values.
Better was to use functions for km, yard, mile.
Probably define macro will work here.
-------------------------------------------------------------------------------
I am an expert and manager of https://www.homeworkhelp4u.com/ tutoring service. We have 18 years of experience helping students to write code, learn computer science, engineering, physics, math, calculus, statistics and other subjects. Our experts are familiar with courses taught in United States, Canada, Australia and UK universities and we produce example solutions that exactly meet all requirements. We have huge database of existing solutions collected from different sources. Feel free to contact me I can find existing solution of your problem or examples for you. (We do not publish solutions we wrote for our clients, but we can do original work for you) Our service is confidential we do not collect customer information. Live help available 7 days week and 24 hours a day with small break between 8pm-1am EST. We answer short homework questions from our existing clients free of charge.
@codehelper, that will work fine until you want to put the results in variables of other names; for example array elements: km[i] = metre[i] * 0.001;
or related names: km_Manchester_London = metre_Manchester_London * 0.001;
at which point a macro - pure text substitution - becomes worthless.
Use a function: it is much more flexible and reusable; a macro isn't either of those.
@lastchance
Thank you for your clarification. I know about limitations and i suggested to use functions in my first post here. But initial question was ambigous. So i suggested additional possible options.
Using functions have some disadvantages. (more code required, slower execution speed) function is prefereble from fundamental theory point. (easy code modification)