Why use "myServo.attach(9)" instead of using "pinMode(myServo, 9)"'?

Would the latter work the same as the former when assigning pin 9 on the Arduino to my servo motor? Could I do the same as the former by using the pinMode either in the way I described or in another way?

Asking in regards to the Arduino "Project 05 - Mood Cue" project.

Thanks,
Ryan

Have you tried it? what were the results?

Could be that the servo library was wrote that way. You are more then welcome to rewrite the servo library to work another way and in changing the library to work your way will reveal why the servo library author wrote it the way he/she did and would be a great learning experience. Good luck.

The attach call activates library control of that pin in its interrupt handler, as well as sorting
out the pin mode.

Being open source you can read the full source code for the library and see how it works.
In fact its recommended to at least read the comments in any libraries .h file as well as
some of the examples.