When programming, you often have to think of names for functions, classes, variables or constants. In principle, you can name these names freely, but the following rules apply:
You can also put several words together and separate each of them with a capital letter or an underscore “_”:
number_lines or numberLines
size_in_pixel or sizeInPixel
start_line or startLine
(“sizeInPixel” is also called camel-case, because it looks like camel-humps, “size_in_pixel” is also called snake-case).
In general, the following has worked well:
const NUM_BALLS = 10
dots = 100
The constant editor provides sliders and buttons that can be used to modify the code currently visible in the code editor with the mouse or finger (on a tablet).
The editor only changes so-called constant statements. See also the entry “Constants”.
The term “debugging” refers to tools that are used to clean a code from so-called “bugs” or errors. Incidentally, these are called “bugs” because the first computers actually had to be freed from bugs and moths so that they could function properly.
Debugging tools also allow you to observe code during runtime, i.e. while a game is running or an animation is displayed. You can monitor different states and find out what is not working properly. With the Oxocards Mini series, this debugging goes much further. Through the interactive observer mode, you can now even see which line of code the Oxocard is currently busy with. This makes the mechanics behind a program visible, which makes many things easy to explain.
Compile is a synonym for “translate”. When we program computers, we do it in a form we can read, called a programming language. The compiler or translator converts these instructions into machine-readable and executable instructions. This process proceeds in several stages. In the first stage, a lexical analysis is carried out to check that the individual terms are part of the language and that no statements have been misspelled. In a second part, a much more extensive semantic check is performed. This converts the program code into an internal structure. The compiler now checks whether the “sentences” make sense. In a third step, the code is converted into many small individual instructions, which the computer can then understand and execute.
A compiler is not absolutely necessary to program a computer. Theoretically, it is also possible to write machine language directly, which is called assembler. However, this consists of very simple individual instructions, so that a simple NanoPy program, which may consist of 10 lines, can quickly produce 1000 assembler instructions.