How to get object's X,Y,Z location within world via script?

Total newbie here.

How do I get an object’s X coordinate in the world via script? I see this is done in the Inspector, and I’d like to know where this info comes from.

I tried using transform.position.x, but this gave me the distance between two points in the world, which is not what I want. I need the absolute value of where the object exists in the world.

transform.position.x it is, debug it out in the update and you see ot matches