You learn by making mistakes. Sometimes you may get demotivated by spending hours or even days to debug an syntactical or logical error. It doens't need to be that way, you are not the only one. Here are a number of links that direct you to frequent errors and solutions.