This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
danielsv03's profile picture

Repeat specific times

Started by danielsv03, 27 January 2017 - 06:21 PM
danielsv03 #1
Posted 27 January 2017 - 07:21 PM
Hello hoe can i repeat a specific line ex times

like

____________

com = read()

a = string.len(com)
and then repeat (a) time

end

how should i do that

because a is length ex Hello = 5 in A

Please help
Dog #2
Posted 27 January 2017 - 07:55 PM
What you're looking for is a 'for' loop…

com = read()
a = string.len(com)

for i = 1, a do --# this will loop the number of times equal to a
  --# do what you want done in a loop here
end