Let $X$ be a nonsingular projective algebraic variety over $\mathbb{C}$. Let $L$ be a base point free line bundle. Bertini's theorem asserts that general divisors in the complete linear system $|L|$ are nonsingular.

An example is $X=\mathbb{P}^n$, and $L=\mathcal{O}(m)$, for $m\ge 2$. The singular divisors of $|L|$ always forms a hypersurface (codimension =1).

My question is:

Can singular divisors form an algebraic set of arbitrary codimension in $|L|$ for $(X, L)$?

Thanks.