Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Problem: You have a little brother who is an annoying copycat.
- -- When you say a word, he'll repeat it once for every letter in
- -- the word. Hint: Use string.len(s) to get the length of a string.
- -- Ex: string.len("Hello") will give 5. Given a word you've said,
- -- print what your brother would say.
- -- Solution: Print the word until a counter is equal to the length
- -- of the word.
- -- Input
- word = "code"
- counter = 0
- -- Output
- while counter < string.len(word) do
- print(word)
- counter = counter + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement