Is there another way to make the attached code shorter and easier to read? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is there another way to make the attached code shorter and easier to read?

https://code.sololearn.com/cUZ8m6os3hlW/?ref=app

2nd Jan 2018, 5:23 AM
Дамир Сулейменов
Дамир Сулейменов - avatar
2 Answers
+ 4
1) Use proper indentation. a) Use proper indentation. b) Use proper indentation. 2) Have empty lines between important structures, like for loops, method definitions, etc. 3) Always make if statements take up 2 lines (at least), for better readability. 4) Use ternary operators where you can, for better conciseness (may harm readability) 5) Enjoy coding! 😉
2nd Jan 2018, 5:30 AM
LunarCoffee
LunarCoffee - avatar
+ 2
ok, thank you for your advices! 😉 I also eager to know how this code would look like in a professional way.
2nd Jan 2018, 5:49 AM
Дамир Сулейменов
Дамир Сулейменов - avatar