"do" statements and value function
gandalf at doctorTimothyMiller.com
Sat Jun 18 22:21:19 EDT 2011
In the process of getting a slightly tricky script to work, I've been pondering the "do" command and the native value function.
I've made an inference. I suspect one could get along without the "do" command by judiciously employing the value function, e.g., value(foo) or "the value of foo"
I haven't tested this thoroughly yet. Is it true? If it's true, it helps me understand "do" a little better. If not, there's something I'm not getting.
While on the topic of the value function...
Lets say value(mySillyVar) = line 2 of field "foo"
And then value(line 2 of field "foo") resolves to "the short name of this card"
And the short name of this card = Hi Mom
Will value(foo) resolve to "Hi Mom" ?
I tried it in a test stack. After some trial and error, it seems that value(mySillyVar) forces only one evaluation. It produces line 2 of field "foo"
Further experimentation reveals, to my surprise, that
actually does resolve to "Hi Mom"
How many times can you nest the value function? I did look in the documentation, couldn't find the answer.
I haven't tried this in a "do" statement. If I wanted to resolve a nested value "all the way down" would one "do" statement work, or would I have to put value functions inside the do statement?
I understand that if I ever actually need value(value(value(value(mySillyVar)))) I'm probably doing it the hard way. One might suffer a brain aneurysm while trying to maintain a script like that.
You've heard of visual learners, tactile learners and olfactory learners? I've always been a learn-by-messing-around-learner. (It's also called "ADHD")
Thanks in advance,
More information about the Use-livecode