Math Animation Question

Hello. I have a general question about Maya's features. I have been learning this software for some time, and I am wanting to make a video of simple math problems and demonstrations. I am curious if there is a way (maybe in MEL perhaps?) that you can link the length of a line or size of an object with a value rendered or displayed on screen. For example, If I were to show a line growing in size, and I wanted to have a number next to it that shows the actual numrical length of it, is there a way to have Maya generate this number instead of me having to do the math myself and change the number and render it out "by hand?" Thank you in advance for your time.

I bet there is. Maybe you should look at somehow attaching the text tool output ti the lenght of the object or something like that...

there is also the distance tool which displays the distance between two points

you can do it via expressions:
get the vertecies coordonates with float $coord[] = xform -q -ws;
then get the distance between the two diametral vertecies with the well known formula
and finaly change the myTextNode.text value with this one

and i believe you can do it with nodes only too like this:
attach two locators to the two vertecies (with the folicle node or djRivet if you dont have Unlimited)
and plug them into a distanceBetween node. Now plug the distanceBetween into myTextNode.text
didnt try the nodal way though, but it should work...

Or even easier the arc len node that allways measures the length of any point on curve.