Hi all !!!
set my_list to {1, 2, 3} repeat with my_item in my_list
beep my_item
delay 1 end repeat
Why this script does compile ? For me, the variable “my_item” is not defined. Unless "my_list define “my_item” ???
Have a nice evening !
Pascal
Hi all !!!
set my_list to {1, 2, 3} repeat with my_item in my_list
beep my_item
delay 1 end repeat
Why this script does compile ? For me, the variable “my_item” is not defined. Unless "my_list define “my_item” ???
Have a nice evening !
Pascal
Hi all !!!
set my_list to {1, 2, 3} repeat with my_item in my_list
beep my_item
delay 1 end repeat
Why this script does compile ? For me, the variable “my_item” is not defined. Unless "my_list define “my_item” ???
Have a nice evening !
Pascal
The script is better formatted as follows (I’ve substituted say for beep just to clarify):
set my_list to {1, 2, 3}
repeat with my_item in my_list
say my_item
delay 1
end repeat
With each repetition of the repeat loop, my_item is set to an item in my_list. Thus, the loop repeats three times and says 1 then 2 then 3.
To be technically correct, my_item is set to a reference to an item in my_list, but that doesn’t affect the operation of your script and is best left for another day.
if you format it like this, it will …
set my_list to {1, 2, 3}
repeat with my_item in my_list
beep
my_item as string
delay 1
end repeat
Thanks Peavine !!!
Got it ! I’m learning !
Pascal