Reputation: 13
Do While Alien(0).Text = Alien(1).Text Or Alien(2).Text Or Alien(3).Text Or Alien(4).Text Or Alien(5).Text
rand()
Alien(0).Text = WordBank(Word)
Loop
rand() chooses a random word inside an array and assigns the random word to the Word variable
Upvotes: 0
Views: 109
Reputation: 18310
You cannot compare strings like that. You've got to re-check Alien(0).Text
for every Or
, otherwise it tries to evaluate your strings as Boolean
values (True or False).
This is why you get the error: a string (other than "True"
or "False"
) cannot be converted into a Boolean
, because, how would the compiler know how to convert for instance "Bear"
into either True
or False
?
Also, it is much better to use OrElse
since it is short-circuited, meaning if one check succeeds it won't bother checking the rest of them.
Do While Alien(0).Text = Alien(1).Text OrElse Alien(0).Text = Alien(2).Text OrElse Alien(0).Text = Alien(3).Text OrElse Alien(0).Text = Alien(4).Text OrElse Alien(0).Text = Alien(5).Text
Upvotes: 3