How is it possible that the method closes or returns?
Or how is it possible to write such a dialog?
Perhaps you are planning ahead, but you don’t need Method1 or Method2 methods to do this.
Maybe all you need is:
Button1 Pressed
if textfield1.text <> “yes” and textfield1.text <> “no” then
close
else
if textfield1.text = "Yes" then
textfield2.text = "You said yes"
else
textfield2.text = "You said no"
end if
Yes, I’m planning ahead. This came out of another project where it was actually necessary to do this. I just simplified things so that all would be left is the question as to how a method could return a string variable as a method.
That’s not what you’re doing. You are retrieving a string from one or the other method. Then you are returning that string. You could manipulate that string in any number of ways before you return it. Once you obtain the string from the method, it no longer has any connection to the method. It’s just a simple string.
This is why I always supply the () for any method I call, even with no parameters. I’ve not come across another langauage that doesn’t insist on the params, and supplying them makes it quite clear that I am making a method call.