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 they needed to run any command with sudo, if sudo are executing the true command correctly, it will return true for the if condition, then sudo is enabled, else you typed the password wrong, or sudo is not enabled, them the 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.