Need help in basic conditional coding

Hi,

I am very new to coding and I am trying to figure out how to do one thing and I just can't figure it out. Here is what I am trying to do.

I can either get "yes/no" or "password" prompt. If I get yes/no, i like to send "yes" like I got it here but if I get "password" prompt, I like to send passw.

The way I got the script written, if I get password prompt first, the script will get stuck.

expect "(yes/no)?"
send -- "yes\r"
expect "*assword:"
send -- "passw\r"

Thanks in advance!

Could you please post the code you have tried so far?

[LEFT]That's just it, I don't know how to do conditional statement to respond accordingly. If anyone could put the coding where it can expect either "yes/no" or "password" and then i can put send statement accordingly.

thanks!
[/LEFT]