Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

declaring vs initializing variables

/*
Declaration of a variable in a computer programming language is a statement
used to specify the variable name and its data type. 
Declaration tells the compiler about the existence of an entity in the 
program and its location. When you declare a variable, 
you should also initialize it.
i.e: let name: String = ; (as long as there is nothing after the equal sign (=)
the variable has been declared.

Initialization is the process of assigning a value to the Variable. 
Every programming language has its own method of initializing the variable. 
If the value is not assigned to the Variable, 
then the process is only called a Declaration.
i.e let name: String = "Hatake Kakashi" (This means the variable name has been
initalized using Hatake Kakashi.
*/
 
PREVIOUS NEXT
Tagged: #declaring #initializing #variables
ADD COMMENT
Topic
Name
6+2 =