Page 2 of 2
Re: building an answer string programmatically
Posted: Thu Jan 14, 2021 12:45 am
by dunbarx
@Bruce. It was me with the "do" stuff.
@Jean-Marc.
I don't suggest using "do" in my post.
You did nothing to be ashamed of. This is spiraling out of control. Bruce mistook you for me, and now you are mistaking you for "do".
Yipes.
Craig
Re: building an answer string programmatically
Posted: Thu Jan 14, 2021 12:50 am
by jmburnod
Re: building an answer string programmatically
Posted: Thu Jan 14, 2021 5:27 pm
by jacque
I mention this because "do" constructions are considered old-fashioned
Not really, there are occasions where "do" is required and useful. The reason to avoid it when possible is because it has to load the compiler on every instance which creates unnecessary overhead. The same is true for the value function.
Re: building an answer string programmatically
Posted: Thu Jan 14, 2021 6:42 pm
by dunbarx
Jacque.
Not really, there are occasions where "do" is required
As in this case, I believe.
This is the regular "do" method, which works:
Code: Select all
on mouseUp
put "All or Nothing or Something" into temp
do "answer test with" && temp
end mouseUp
I recall, many years ago, that I could create another level of evaluation by modifying the "do" line. But I cannot duplicate it:
Code: Select all
on mouseUp
put "All or Nothing or Something" into temp
do "get" && temp
answer "test" with it
end mouseUp
No dice. Do you know? Not that it matters, just an old, old memory,
Craig
Re: building an answer string programmatically
Posted: Fri Jan 15, 2021 6:31 pm
by jacque
It does seem to be required in this case. I was only commenting on the reason I try to avoid using "do". I think I've only needed it a handful of times over the last several years, usually there's a way around it.
I suspect the reason your last test case fails is because the button options are missing quotes. Bernd's handler fixes that.