As an example, in the BFOIT jLogo lessons, you enter source code into the TG applet and/or application.
An example of the last feature is:
int variable = 123;
...
System.out.println( "variable contains: " + variable );
In this case, the contents of variable is converted from
an integer into a String and then combined with
"variable contains: " into a single String object which
is passed as an argument to println( ).
The syntax of a programming language is very specific so that its interpreter or compiler can do exactly what the programmer wants. Some languages have a simple syntax, others can be more complex. Since TurtleTalk is simple (a limited subset of the computer language Logo) it has a fairly simple syntax. On the other hand, Java has a much more complex syntax.
Common syntax errors that you will probably make, regardless of which language you are using are:
Syntax errors unique to Java that are common include:
Syntax errors are caught by the TurtleTalk interpreter and the Java compiler; so, a program that has syntax errors will never run. TurtleTalk complains when it discovers a syntax error and ignores the command that's bad, and the rest of the commands on the line. The Java compiler also complains when it discovers errors. It will not generate the .class file as long as there are syntax errors.
There are lots of little things you can do to help you keep from making syntax errors, mostly conventions that you adopt and then stick to, every time you write some source code. An example is indenting parts of the source code so that things line up and/or stick out to show the structure of the program.
Back to Table of Contents