+ 1
I write a code it keeps saying "compilation error" what should I do
Learn to code
8 Answers
+ 6
Where is your code? With incomplete information how we would know that what problem you are facing.
+ 6
If you opt for the HonFu technique, there is a way to reduce the complexity of that method from O(n) to O(log(n)) by commenting out half the code first. If it now compiles, the error was in the commented half so you can uncomment half of that half and retry. On the other hand, if it still did not compile, then the error was in the uncommented half, so you can apply the commenting trick to that half and retry đ. This becomes more tedious if there is more than one compilation error.
+ 5
Remember that if you are using a language that uses curly braces to denote scope {}, if you comment out one of them (e.g. starting brace, you also need to comment out the corresponding ending brace etc.)
+ 5
While all this can be a bit silly, the error message from the compiler usually indicates which line the problem is in. That way you can go straight to the problem area O(k). Unfortunately SL code playground error messages don't help here.
+ 4
Comment out your code except the first line.
If it works, add the second line.
If it works... and so on.