EasyCoder documentation

   

Structure

Any web page can contain a single EasyCoder script, which lives inside a special <pre> tag like this:

<pre id="easycoder-script">
(EasyCoder commands)
</pre>

When the page loads, EasyCoder looks for this tag, extracts the script then compiles and runs it. What happens then depends on what commands are in the script; see the other documentation pages for more information. The effect is the same as if a JavaScript or JQuery module had been added to the page, but EasyCoder is much simpler to learn and does most of the more common things that would otherwise have been placed in external JavaScript files.

You'll find EasyCoder scripts in the examples and in the home page itself. If a page contains a script it's pretty easy to spot in the page source, which you can find on most browsers by typing Control-U. The language is nearly all plain words, with very few symbols used. We use backticks (`) instead of single or double quotes to contain literal text strings as they are rarely if ever needed in normal text and because the WordPress editor messes about with quotes, converting them into smart quotes and generally giving our compiler a hard time. The advantage is you can include single or double quotes in your text strings without any special attention needed.

Other symbols include the exclamation mark, which starts a program comment, and a colon, which identifies a program label. Labels are used when you want to tell execution to go to a particular place rather than just follow line after line. So you can do

  go to Next
...
...
Next:
print `Arrived at the "Next" label!`

EasyCoder is fairly strongly typed, which means variables have specific attributes and behaviors, much in the same way human languages do. So you might throw a stone or cut a loaf but are rather less likely to throw a loaf or cut a stone. English is full of such strong typing.

Another characteristic of English is that the name of something starts with a capital letter but its type does not. So if I write

  dog Rover

then I hope you would understand "Rover" to be a named instance of a "dog". Most computer languages do things exactly the opposite way round, using an initial capital letter for the type then a lower for the name, which seems quite strange to non-programmers. At EasyCoder we prefer to stick to what ordinary people find familiar.