Well I never!

Kay C Lan lan.kc.macmail at gmail.com
Mon Mar 30 09:21:20 EDT 2009

On Mar 28, 2009, at 8:43 AM, James Hurley wrote:

> RR won't compile [top shelf], is "shelf" a parameter associated with "top"?
> Or was it an abbreviation  for top_shelf or maybe  topShelf?

On Sun, Mar 29, 2009 at 12:14 AM, Jim Ault <jimaultwins at yahoo.com> wrote:

> house["kitchen"]["refrigerator"]["top shelf"]
> I left out the quotes so it would read better.

James, now that you've had two days to digest everything, it is probably
worth pointing out that the use of quotes is not necessary - well not for
single words anyway - and the cool thing is that if you don't use quotes Rev
will automatically determine if you are using a variable within the
brackets. Copy and paste this into the multi-line message box and see if
works as you'd expect:

put "Aardvark,Aaron,12 Alison St" & cr & \
 "Bloom,Billy,43 Back St" & cr & \
 "Bloom,Betty,43 Back St" & cr & \
 "Carver,Cissy,76 Crown Ave" into tStore
repeat for each line tLine in tStore
 put item 1 of tLine into tSurname
 put item 2 of tLine into tFirst
 put item 3 of tLine into tAddress
 put tAddress into yr8array[tSurname][tFirst]
end repeat
put the keys of yr8array["Bloom"] & cr after msg
put yr8array[Bloom][Billy] after msg

Note how by NOT quoting you can use a variable - which is why multiple words
must be quoted because a variable can only be a single word. On the other
hand, in the last line I didn't quote Bloom or Billy but Rev still produced
the correct answer. This is not always the case, if earlier in the script
there was a variable named Bloom or Billy the results could have been
different (most likely empty) so, from what I've learnt from this list, to
avoid confusion most people quote strings so that only variables are
unquoted inside array brackets.


More information about the Use-livecode mailing list