How does Raycast layer mask work?

If I set the layer mask on a raycast will it ignore collisions with those objects or will it return false if the ray collides with an object of that layer?

The raycast will only return collisions with objects that match the layer mask.