As I see in this script. It is just checking if sudo is enabled, that is it..
true just returns true.
So in this case if they neededneed to run any command with sudo it checks at start first, asking the password only one time.
The condition works like this: if sudo are executing the true command correctly, it will return true for the if condition, then sudo is enabled and the user typed the password correctly, else you typed the password wrong, or sudo is not enabled, them the script script must not continue.
The other commands do not need to ask sudo password, because your authentication are sucessfully in first time (but this depends on the sudo configuration, so this scripts depends much in the environment configuration)
The 'echo password ok' demonstrate that too. the shell script will not ask the password anymore.