Function that reads a defined port

Hi there, I am using a L432KC board. My aim is to be abe to read 5 potenciometers with the same function.
This is my code, I wonder how could it be done correctly.

Hello,

please, do not use not printscreen, use copy & paste the code and place it between 2x ``` (before and after code).

char ReadServo(string sensor)

That is of course wrong. You want to refer your AnalogIn objects to your function. So you need to use type of AnalogIn and not string.

char ReadServo(AnalogIn sensor)

BR, Jan