Ask coding questions

← Back to all posts
I am confused
joshuam6060 (0)

what am I doing wrong - I am making a game where there are a bunch of words and the player has to say how many syllables one of them has.

Coder100 (8396)

it appears you are trying to check if an item is in a set.

Here's how!

if Set(["apple", "candy"]).contains(randomName) {


pretty easy :D

read more

DynamicSquid (3558)

use == to compare two values

joshuam6060 (0)

I tried but there is something else

DynamicSquid (3558)

@joshuam6060 also try: randomName == "apple" || randomName == "candy" instead. you could always look up your errors online