It can be helpful to know how to talk to your computer about computations. While working with code language can tend you to run away and hide, the computer really just wants to understand what you're saying so it knows what to do. And the computer works very logically. He follows the rules, and he will listen and do his best to accommodate your needs.


Being unclear in what you want or confusing your characters does not work well with a computer. Not only does the computer not perform the computation, but it will not store your code either. That's not out of hate, the computer simply needs the correct "simple" directions to do what you ask. The following rules will get you started.

 

Signs and symbols

You have probably seen or used the symbols and signs below. For example, when creating conditional content. But what do they mean?


Meaning

Code

Equals

==

Does not equal

!=

Is greater than

Is greater than or equals

>=

Is smaller than

Is smaller than or equals

<=

Add

+

Subtract

-

Multiply

*

Devide

/


Meaningful text

Text is read as an object: the computer does not understand exactly what you mean when you write "why does this calculation not work" or "stop giving errors", but the computer does recognize certain meaningful words or concepts such as 'var' , 'data', 'return', 'if', 'else', 'and' and 'or'. Then the computer knows what you are asking for. Below is a list of code language for the computer.


Code   
 Meaning
FunctionThis is the machine in which the calculation is performed.
VarA variable. This is the basket in which you put your data.
ReturnReturn means what you want to get back at the end of your function. This is the value that the computation will 'return' if you use the (name of the) function somewhere.
DataData contains all the answers that the user has entered in your document.
AndBoth computations must be true (or false). For example; if someone replies that he speaks English AND Dutch, give back: bilingual.
OrOnly one of the computations is true (or false). For example; if someone answers that they want an apple OR a banana, give back: "fruit".
{}Each function or if-statement opens and closes with a parenthesis (either "{}" or "()" or "[]"); The calculations that go together are in the same parentheses.
,
Commas separate functions from each other, so they are always at the end of a function, after the curly braces, {like this},
;

At the end of each line of code that the computer must read before moving on to the next is a semicolon; 

{Also at the end of your code};

//Place two forward slashes before a line to make the computer ignore a line of text or code. This way you can leave comments for yourself or for other editors, for example to clarify why you did something or to block a specific piece of code to test if there is a bug.


Names and numbers


Numbers are recognized as numbers. You can use them in a "sentence" and the computer will know what you mean. The computer also recognizes a series of letters if you put them in "quotes". For example, if you want a computation that depends on the value of a question that has been written out, such as "depression", or "aggression".