optical shaft and potentiometer

so ive looked at the sample templates and the tutorials and i still dont understand how to program either the optical shaft encoder nor the potentiometer on the CORTEX4. I get the basic values and how they work, but if i want to program the autonomous to, idk say, lift and arm using optical shaft, in motor ports 1 & 10, and raise it to a value of 100, how would i do that and make it stop once it hits 100. Then the same thing with the potentiometer.

This is one way you could do it, the motors run while the encoder is less then 100. Once they greater than or equal to 100 the while loop ends and it stops.


Run Motors 1 and 10

while(encoder <= 100) {
    encoder = GetEncoder 
}

Stop Motors 1 and 10

ok thanks, so that is for the encoder, do yoy know how to do it for the potentiometer, or is it the same thing