Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

The Type int [14/14]

This program uses modulo operator (%%) to compute position and color of a moving disc.

You should analyze in detail the role of modulo operator in this program in order to get a better understanding.

Tip: analyze the behaviour of numbers in the upper left corner of the screen while the program is running; observe how those numbers affect the color and position of the disc.

After running and analyzing this program, try modifying the number 100 in the expression that sets the initial value of variable x. Try the following values: 50, 10, 200, 133, 57.

* * *

-- Static Type Systems --

All type errors are detected before a program is started. No type errors can happen while a program is running.

This is accomplished by a static type system. An advantage of static type systems is that type errors are detected before the program is run.

Static type systems also enable faster execution of programs.

Static type systems are especially suitable for beginners, as they reduce the number of errors in programs.

Other popular languages that also use a static type system include: C++, C#, Java.

Popular languages that use a dynamic type system instead include: Javascript, PHP, Python.

Loading...