Programming display/implicit declaration


According to declarationIs a statement in a program that lists a set of variable names and specifies the type of those variables.
Such as C, C++, Java

Copy the codeThe code is as follows:
// displays the declared variable count, which is of type int and may take up a different amount of space from language to language
int count;

And as JavaScript

Copy the codeThe code is as follows:
// displays the declared variable count, but does not know its type or the size of its footprint
var count;

Implicitly declaredBinding of a variable name to a type by some default convention
For example, in Fortain, a value that begins with the letters I, J, K, L, M, or N (or its lowercase counterpart) is implicitly declared as Integer. Otherwise, type Real.
In the Javascript

Copy the codeThe code is as follows:
// the assignment statement implicitly declares the variable count, which is of type number and takes 8 bytes (64-bit floating point format)
// all implicitly declared variables are global by default, whether inside or outside a function
count = 10;

Implicit declaration is a little convenient, but it is considered to be bad for the readability of the program, because it may bring hidden errors and bugs.
Implicit declarations are also available in Perl, but to avoid these problems. It does something
1. The default scalar, beginning with the character $, can store strings and Numbers
2, the default is an array starting with the character @
3. Default is a hash structure starting with the character %.

As you can see above, most languages require variables to be declared, except Fortain, Perl, JavaScript, and ML.
Fortain, JavaScript includes both a display declaration and an implicit declaration.