Posted: Mon Jan 21, 2013 6:26 pm Post subject: Need help with for structure (beginnger)
What is it you are trying to achieve?
Im making a hangman game and I need a for structure that will make dashes/lines for the number of letters in a word
i.e if the word was cat ; _ _ _
I have the words in an array and I have a randint that generates a random number which I assign to each word in the array
What is the problem you are having?
don't know how to make a for structure to make the lines/dashes for the length of multiple words
Describe what you have tried to solve this problem
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
.
Turing:
<Add your code here>
Please specify what version of Turing you are using
<Answer Here>
Sponsor Sponsor
DemonWasp
Posted: Mon Jan 21, 2013 6:39 pm Post subject: RE:Need help with for structure (beginnger)
You can use the method length(word) to get the number of characters in the given word.
For example, length("cat") is 3, length("hello") is 5, and length(word) will be the number of letters in the string represented by word.