Else needs to be the last part of an if statement. Can you get this if statement to make sense?

Yes, that's the order that makes sense!

Are you creating password before using it and putting the if part before the else part?