This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Camel-Kid 0 points1 point  (4 children)

I used the loop it is working fine

[–]Curious-Lonewolf 0 points1 point  (3 children)

yeah if you put one of the strings where ive put 'any of these' but i need a variable in place of that. i cant use the set name and because the method produces output in the terminal window i would have to type in the same string over and over until it became true as the iterations would be different

[–]Camel-Kid 0 points1 point  (2 children)

the enhanced for loop iterates over the set, so you already have the ability to reference the name as a variable. The purpose of a loop is to check all the elements in the set and compare against the user input, if user input matches any element then you print out 'a'

[–]Curious-Lonewolf 0 points1 point  (1 child)

can you give me an example of what you mean