Post Your Coding Tips! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Post Your Coding Tips!

Any helpful coding tips, please share here!

25th Jun 2017, 4:11 PM
uCoder
uCoder - avatar
6 Answers
+ 28
Learn and never give up. That's all you should know. Really.
25th Jun 2017, 4:19 PM
Igor Makarsky
Igor Makarsky - avatar
+ 18
Using loop variables? I suggest ii instead of i, jj instead of j, etc. Why? Try searching for i or j to track down the usages of the variable..... If you're comparing a fixed value to a variable, use something like (1 == x) instead of the other way around. Why? One of the things I tend to do is leave out one of the =...... if you assign to a variable, most languages will evaluate that add true in a Boolean context, which is not what you were after typically. If you put the fixed value first (also called Yoda conditionals for extra cool points!), then the compiler/interpreter will save you a debugging headache. Using a language which uses braces to denote code blocks? Lay out the closing brace when you set up the opening one. I know that formatting conventions can be a pain, but they really are a matter of experience informing practice. For your own sanity, as well as that of those who check out your code, use your tabs! You'll thank yourself when you come back to what you wrote.
25th Jun 2017, 4:32 PM
Jim
Jim - avatar
+ 10
think twice code once
25th Jun 2017, 4:53 PM
Hetbo.net
Hetbo.net - avatar
+ 8
if you are confused about a bit of code and you have already done it before look back at your old code because you are more likely to learn it that way instead of just going on Google
25th Jun 2017, 4:23 PM
Cheesy Game Studios
Cheesy Game Studios - avatar
+ 3
Write Code Every Day! In my view, that's the only way to learn it beyond syntax of any language. After you know syntax the actual programming/coding starts.
26th Jun 2017, 9:41 PM
Pramod
+ 2
never repeat yoself. DRY(DON'T REPEAT YO SELF) principle is a must. cause it makes it easy for you to maintain the code.
26th Jun 2017, 4:23 AM
Chad Tims
Chad Tims - avatar