Euphoria Syntax and Errors
We need to briefly touch on possible errors that might occur while you are learning to program. Euphoria has a strict syntax (a set of formatting rules) to which all input must adhere. If you vary from this syntax, Euphoria will print an error message to the screen. Errors are inevitable, and I don't want you to freak out if you see one. So, let's get familiar with them...
Create a new file called errors.ex and add the following line:
? one plus two
Do you know the answer to that formula? Sure you do! It's easy! (One plus two equals three.) Let's see what our computer can make of it. Save the program and run it (remember, type eui errors.ex). Here's what your screen should look like:
killme.exw:1
<0074>:: Errors resolving the following references:
killme.exw (1): plus
killme.exw (1): one
? one plus two
^
The first line of output tells us that there is an error on line 1 of the program errors.ex. The second line tells us what the error is ("Errors resolving the following references:"). The third and fourth lines help us pinpoint the problem on the line specified in line one of our output. This error happens to be an undeclared variable error, meaning that Euphoria doesn't know how to deal with the variable named "one."
This is the general format of an error message from the Euphoria interpreter. We'll discuss error messages in more detail along the way. I just wanted to give you an idea of what they were so you wouldn't be surprised if (or when) you encounter one.