Page 1 of 1

First part of a line of code works? Not the second?

Posted: Thu May 19, 2016 2:14 pm
by dunbarx
Hmmm.

Make a button and a field on a new card. Put this into the button script:

Code: Select all

on mouseUp
    put random(999) into fld 1 in cd 1
end mouseUp
Now the keyword "in" ought to be "of". Everyone knows this. Though in HC "in" and "of", at least in this context, are synonyms.

But I find it interesting that a new random number is placed into the field before the line of code throws an error.

Is this just how LC works. one word at a time?

Craig Newman

Re: First part of a line of code works? Not the second?

Posted: Thu May 19, 2016 2:49 pm
by FourthWorld
I've never seen "in" used like that in object references. Does that work in HC?

Re: First part of a line of code works? Not the second?

Posted: Thu May 19, 2016 3:50 pm
by Klaus
Hi Richard,
FourthWorld wrote:I've never seen "in" used like that in object references.
people are quite creative when it comes to "work-around" official syntax :D
I have seen this "...in card x" very often and also "... on card x" in other peoples scripts.
FourthWorld wrote:Does that work in HC?
Well, this is how I interpret Craig's line:
Though in HC "in" and "of", at least in this context, are synonyms.
8)


Best

Klaus

Re: First part of a line of code works? Not the second?

Posted: Thu May 19, 2016 6:23 pm
by dunbarx
Richard.

Yep, synonyms. I alway use "of", but knew from way back that "in" was OK in HC.

There was a thread earlier this week where the OP used "in". I never caught it, because I was used to thinking both were acceptable. In LC, "in" is "out".

Craig