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

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Thu May 19, 2016 2:14 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Thu May 19, 2016 2:49 pm

I've never seen "in" used like that in object references. Does that work in HC?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Thu May 19, 2016 3:50 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Thu May 19, 2016 6:23 pm

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

Post Reply