Question:
If there is a typo in the computer programming will the computer still understand and carry out the command?
Doodelay
2010-07-13 00:32:11 UTC
Say i'm writing a computer code for a program that i would like to create and i were to accidentally make a typo in the coding, would my program become ineffective and unable to run?
Or would the computer skip over the typo and run the program anyway?

Basically what i'm asking is if the coding for a program have to be typo free in order to run on your computer?
Five answers:
Greg
2010-07-13 01:30:37 UTC
A computer language has a very strict syntax that must be followed. If you were to make a mistake with the syntax, then your computer program would not run. However, maddeningly, you can make "typos" that make your program incorrect but still run. These are normally called bugs.



For instance, a syntax error in C/C++:



int i = char number;



This is incorrect, and won't compile.



However:



(if true = false)



will compile, and it will most likely be a bug because you used the assignment operator = instead of the comparison ==.





So to summarize: Syntax is very important. But just because you get that right doesn't mean your program is "typo" free.
anonymous
2010-07-13 07:40:37 UTC
The code has to be correct, your computer isn't capable of guessing what you meant to type instead. Depending on the programming language that you're using you'll either get a runtime error, a compiling error or your computer will crash.



The easiest errors to fix are the ones where the mistake is just nonsense, you'll get an error as soon as you run it that'll stop the program and you'll see where the typo is. Harder to track are the ones where the typo just changes the command/formula/variable for a different one, these often result in overflow or divide by zero errors elsewhere in the program - you have to go through the code to track these down. (These aren't good if the program calculates a payroll for example, unless you receive ten times your pay). There is a typo that you can make on the Linux command line interface that instead of removing a directory's contents will remove the entire root directory's contents - bad news indeed.
jplatt39
2010-07-13 10:25:46 UTC
No. For a program to be compilable or runable the command must be error-free. I don't know about you but I run into a lot of problems with websites and so forth which try to correct my grammar and spelling. Programs which have this capability limit -- intentionally or not -- what people can do with them. Slackware Linux, the oldest currently-maintained distribution and the most UNIX-like, has as its motto "Keep It Simple Stupid". This is NOT easy for users -- you don't see us going out and telling Ubuntu users they should start with it: it's as close to a generic Linux OS as you are going to get and it assumes you know exactly what you are doing. The tradeoff is nobody tells you you want to do something else or that the operation is not permitted.



Errors happen in programs but compilers and interpreters cannot take responsibility for fixing them. If the programmer doesn't -- the results are undefined.
Gamer G
2010-07-13 07:35:36 UTC
Usually if you have a typo there's probably going to be an error compiling the program.
?
2010-07-13 07:37:30 UTC
Probably not, u know how computer r


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...