Created
March 20, 2019 19:32
-
-
Save AAQ-AND-DEV/31e2aba92c5f62c4563ef84508a82b54 to your computer and use it in GitHub Desktop.
first Dart var exploration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
var country = 'United States'; | |
String name; | |
var dynamo; | |
var preType = dynamo.runtimeType; | |
print(preType); | |
//print(name is dynamic); | |
//looks like everything is dynamic?!? | |
dynamo = 47; | |
var type = dynamo.runtimeType; | |
print(type); | |
print(dynamo is String); | |
dynamo = 'dynamic!'; | |
print(dynamo is String); | |
name = '1'; | |
print(name); | |
print('Hello ' + country); | |
print('7.23'); | |
double fraction = 23; | |
fraction += 0.00; | |
fraction = 23.00; | |
//only upon adding a decimal will it print the tenths/hundredths | |
print(fraction); | |
print(fraction.runtimeType); | |
fraction += .5; | |
//interesting that a single var has dynamic typing | |
print(fraction.runtimeType); | |
print(fraction); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment