variable
void main()
{
/*var a = 20;
print(a);
print(a.runtimeType);*/ /// To indicate the type
/*var b = "Rahul";
print(b.runtimeType);*/
/*var c = true;
print(c.runtimeType);*/
//Here,same data_type variable value can be changed using "var" keyword while declaring variable.so whenever we declare
//variable using "var" keyword and when we give particular value to that variable after that we can't change the dataType
// of that variable directly.whenever we declare a variable using "var" keyword and when we don't initialize the value to
//that variable then that variable will treat as Dynamic
/*var d = true;
print(d);
d = false;
print(d);*/
/// Dynamic Variable
/*var t; //Dynamic variable
t = 10; //Assigning integer value
print(t);
print(t.runtimeType);
print("t ${t.runtimeType}");
t = "Hello"; //Assigning String value
print(t);
print(t.runtimeType);
print("t ${t.runtimeType}");
t = true; //Assigning boolean value
print(t);
print(t.runtimeType);
print("t ${t.runtimeType}");*/
/// Dynamic Variable
// dynamic x = 10;
// print("x -> ${x.runtimeType}");
// x = 5.5;
// print("x -> ${x.runtimeType}");
// x = "Hello World";
// print("x -> ${x.runtimeType}");
// x = true;
// print("x -> ${x.runtimeType}");
String firstname = "Can";
String surname = "van Gool";
print(firstname);
print(surname);
String fullname = firstname + " " + surname;
print(fullname);
String fullname2 = "Firstname: $firstname $surname";
print(fullname2);
}
Comments
Post a Comment