OO Remote Shell if statement?

Is there a way to create an if statement using the "Remote Shell" operation? or a way to use something like : expect{

                "something" {send "something"}

                "Hello, World" {send "Hello"}

}

 

What I am trying to accomplish is :

expect (.*\s*)*?

send \r

expectendswith (yes/no):

send yes

expectendswith :

send \r

if{

expectendswith [md]:

send \r

else

send standalone

}

or 

expectendswith [md]: {send \r}

expectendswith [master]: {send "standalone"}