|
Post by rosy on Sept 22, 2021 4:13:04 GMT -6
What happens when I enter "command" e.g. 5> 0? Looks like nothing ... Why doesn't it display an error?
|
|
|
Post by n00b on Sept 22, 2021 7:17:02 GMT -6
Because its not an error. Its just a math expression. You could print that expression as well:
print 5>0
|
|
|
Post by Tomaaz on Sept 22, 2021 9:22:14 GMT -6
5 > 0 is not a command. It's a logical expression that evaluates to true. In many languages if you type this kind of expression in an interactive mode, "true" or "false" will be printed (you don't even have to use print).
|
|
|
Post by rosy on Sept 22, 2021 10:46:29 GMT -6
But what's the point? 1. This is not an interactive mode. 2. Nothing is displayed.
Here we list the commands to be executed, not the conditions. An error should be displayed. For example, by mistake I would enter a-5 instead of a = 5. The program will run badly, and I won't know why, it won't signal an error ...
|
|
|
Post by Tomaaz on Sept 22, 2021 11:45:13 GMT -6
So, you basically want the complier/interpreter to prevent you from making any posible typo that, instead of stopping the program and showing an error message, will lead to a wrong output? What about writing the right code, instead?
|
|
|
Post by aurel on Sept 22, 2021 12:15:58 GMT -6
well my interpreter don't report anything too..heh by design
|
|