Originally posted by Lucky J Verma:
...i believe this former method is just an example of need of else-if,
not a valid syntax as two else's cant be there...
The syntax in the book is valid. Although if you look carefully, you will see it's slightly different than what you've posted.
(Indentation helps to see the differences in these examples. Please use
Code Tags when posting indentation.)