0
can any one tell me how to write code well any language?
how to be proficient
2 Answers
+ 2
The efficience of your code delends on the language. Generally, these are some tips:
-Avoid nested loops
-Avoid so much ifs
-Avoid creating so much variables when it is not necessary and you can store them in arrays
+ 1
Rules may differ between languages, but in general, you should:
- use proper and meaningful names for your variables and functions;
- keep your functions as simple as possible in order to simplify debugging and testing them;
- always make sure that whenever your program opens a file to read it, then it gets closed;
- always make sure that loops will eventually stop;
- always make sure that your program returns meaningful errors.