Sunday, March 14, 2010

Regarding the frst question abouts programe loops?

thanks you for the excellent answers. Now i need to ask what the loops actually do. If possible please be technical....





For Counter = 1 To length


TextBox1.Text = TextBox1.Text %26amp; "?"


Next








For Counter = 1 To length


If letter = Mid(word, Counter, 1) Then


Mid(TextBox1.Text, Counter, 1) = letter


flag = 1


End If


If TextBox1.Text = word Then


MsgBox("Congratulations you guessed it!")


End If


Next

Regarding the frst question abouts programe loops?
Never mind my earlier response. I just looked at the previous question with the whole code sample in it. I'll see if I have anything to add later.





ok,


concerning this code snippet:


letter = Mid(TextBox2.Text, 1, 1)


For Counter = 1 To length


If letter = Mid(word, Counter, 1) Then


Mid(TextBox1.Text, Counter, 1) = letter


flag = 1


End If


If TextBox1.Text = word Then


MsgBox("Congratulations you guessed it!")


End If


Next





1, we need to see where Textbox2.text gets its value.


2, not sure what is intended, but after "letter" gets its initial value, its value never changes. And then this character is placed in TextBox1.text in the location where that character occurs in the string "word". So at the end of the For loop, TextBox1.Text may not contain what it seems is intended, if the value of "word" can contain a variety of characters and you are comparing the strings "word" and "TextBox1.Text" for a match.



diseases

No comments:

Post a Comment