У меня есть список строк разной длины, которые я зацикливаю:
set my_list to {"abc", "defg", "hi", "jklmno"} repeat with the_item in my_list -- get index of the_item end repeat
Как мне найти индекс the_item во время зацикливания?
Вы можете ввести счетчик и обновлять его при каждой итерации цикла:
set counter to 0 repeat with the_item in my_list set counter to counter + 1 -- do stuff end repeat
или использовать другую форму цикла :
repeat with n from 1 to count of my_list -- do stuff with (item n of my_list) end repeat