Wearing a mask is ineffective for the general population.
Yet combined with other precautions, it is a valuable line of defence.
Think of masks as just one layer of a Swiss cheese. Each layer is a defence against the virus. None of the slices is perfect. Each of them has holes - representing the measure's flaws - which allow the virus to find a way through. Yet if there are several layers, the chance the virus will be stopped by one of them is increased.