The guard needs to be outside of the match:
case {level, has_children_or_no_children} do
{n, :has_children} when n < 5 -> 1
{n, :no_children} when n > 0 -> 2
_ -> false
end
The guard needs to be outside of the match:
case {level, has_children_or_no_children} do
{n, :has_children} when n < 5 -> 1
{n, :no_children} when n > 0 -> 2
_ -> false
end