Post Your Coding Tips! | SoloLearn: Learn to code for FREE!

+10

Post Your Coding Tips!

Any helpful coding tips, please share here!

6/25/2017 4:11:05 PM

uCoder

6 Answers

New Answer

+27

Learn and never give up. That's all you should know. Really.

+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.

+10

think twice code once

+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

+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.

+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.