There is right and wrong to consider, no middle ground.
Try understanding the logic first, and the code will automatically be correct (apart from syntax errors, which are easily corrected).

...