different action based on the number of times a button is pressed

What type is pos? If it is an int, than you can't assign 12.5 to it. Writing 12.5 to a servo doesn't make sense, either, since the Servo::write() method expects an int.

// because there is no braces code does not loop and reach pos 18, but moves onto next line

Well, you ought to have them, even if they are not strictly needed. Having them makes them look like you know what you are doing.

If you didn't add this comment, why have you ignored it?

The other code has some braces that you need and some that you do not. You need to learn to tell the difference.