Repeat and Arrays
Posted: Tue Jul 24, 2012 3:19 am
I have been dabbling with Live Code for a while now, but can never figure out how to maximize the use of "repeat" and "arrays." What I am trying to do is to calculate the sum of a word, based on letter values, for each word in a list and then populate the value in an adjacent column.
My approach
Repeat for each word in list 1~n,
Put first word into an array,
Repeat for each letter in word
Put each letter into a nested array,
Assign a value to each letter (If A=1 then put 1 into tNestedArray(Char1) / else if B=4 then put 4 into tNestedArray(Char 1), etc end if(I think that I need to create a function or custom property))
Sum the values to each letter,
Then tab and put a value as item 2
end repeat for each letter
end repeat for each word
My code so far:
if script don't work again then
put computer in trash
end if
Help is needed.
Cheers!
My approach
Repeat for each word in list 1~n,
Put first word into an array,
Repeat for each letter in word
Put each letter into a nested array,
Assign a value to each letter (If A=1 then put 1 into tNestedArray(Char1) / else if B=4 then put 4 into tNestedArray(Char 1), etc end if(I think that I need to create a function or custom property))
Sum the values to each letter,
Then tab and put a value as item 2
end repeat for each letter
end repeat for each word
My code so far:
if script don't work again then
put computer in trash
end if
Help is needed.
Cheers!