Krista's Coding Corner

07.03.2012

First touch to programming 2 (mistakes, bugs, errors…)

Lets continue from the Hello World example:

print “Hello World!”

Now, if you did typing mistake like writing “rint” instead of “print”, you will get an error message. It should say “syntax error”. These error messages are there to help you to find out what went wrong and why the program isn’t working like you wanted (== working at all). This kind of an error is not a bug, but what is?

One of the most common bugs has something to do with your programs logic. It means that your program runs somewhat nicely but it doesn’t do its tasks right and it could even crash. You could define bug as “something went wrong after the program has started”. Syntax error will not allow your program even to start, so it is not a bug :)

Here is simple example of a program that is supposed to print “Hello world!” but actually it prints “Good Bye World!”:

print “Good Bye World!”

As you certainly see, the program is just like the first “Hello World”, but it just has different / wrong text in it. This is bug (okay, really brainless one…). But hopefully you will get the point.

blog comments powered by Disqus