@The-Darkin-Blade Good question! It's just for organizational purposes, actually. We want to sort the different ways that we are trying by setting \(x\) to be the shortest side.
If we didn't have this requirement of \(x \leq y,\) then we might have \(3, 5,\) and \(6,\) as side lengths on our list of things to check in addition to side lengths \(5, 3\) and \(6,\) which are really the same combination.
So, in a nutshell, this requirement ensures that we cover all the cases without doing any of the cases twice!