Created
November 25, 2019 20:15
-
-
Save r3dm1ke/df0fd36928809be0d4a710751539a4b8 to your computer and use it in GitHub Desktop.
Different types of variables in Dart
This file contains 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() { | |
// Create a variable name of type String | |
var name = 'John'; | |
// Create a variable last_name of type String | |
String last_name = 'Smith'; | |
// Create a dynamic variable age, which is of type int for now | |
dynamic age = 18; | |
// Age is now of type List | |
age = ['what', 'the', 'hell']; | |
// Declaring a constant variable of type double | |
const double PI = 3.14; | |
// This would throw an error | |
PI = 3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment