Random generator exercise
Dar Scott
dsc at swcp.com
Wed Jan 22 14:12:01 EST 2003
On Wednesday, January 22, 2003, at 11:05 AM, ncouch wrote:
> put it into char x of field "random"
I didn't realize that would work. I see it does. I usually use
"after". Also, I would build the string and then put it into the field
after it is built.
>
> on rnum
> global x
> put random(9) into rn
> put rn into char x of field "random"
> end rnum
This is not really a good way to use global. I'd avoid it. You can
pass x as a parameter.
For that matter you can return the char as a function value and
accumulate it in the main loop.
I would also avoid unneeded uses of fields. I think field "Alpha"
should be a constant.
Best wishes on your exercise!
Dar Scott
More information about the use-livecode
mailing list