Yes, that's how it works.

To catch when it's NOT just two, you have to use bit comparsion, if (selected & (GLASS|IRON))