+ 2

About var data type.

if var itself identifies the value and automatically declares the variable so why we need to use other data types as var does the work?

12th Aug 2017, 4:57 AM
Ankita
Ankita - avatar
2 Antworten
+ 1
Var is a Keyword and is used to declare the variables such ass array string etc. Do not use var to declare the data type for the property (properties) as well as the return type of the method (method) in the class.
12th Aug 2017, 6:13 AM
KANHAYA TYAGI
KANHAYA TYAGI - avatar
- 1
Var is a box around a variable. In this way the variables can be passed more easily through methods. Notice that the type is set on initialisation. Notice also that is not the same as the historic undefined var. Really you need strong data typing to prevent you from strange u expected errors.
12th Aug 2017, 8:06 AM
sneeze
sneeze - avatar