|
|
|
@ -39,6 +39,32 @@ void basic_build_in_types() {
|
|
|
|
|
print("hitPoints <= 0? ${hitPoints <= 0}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("\nDart Strings:");
|
|
|
|
|
String str1 = "It's a string with double quotes";
|
|
|
|
|
String str2 = 'It\'s a string with single quote';
|
|
|
|
|
String str3 = """
|
|
|
|
|
It's a long string with triple double quotes
|
|
|
|
|
這是一個很長的字串
|
|
|
|
|
""";
|
|
|
|
|
print(str1);
|
|
|
|
|
print(str2);
|
|
|
|
|
print(str3);
|
|
|
|
|
|
|
|
|
|
const aConstNum = 0;
|
|
|
|
|
const aConstBool = true;
|
|
|
|
|
const aConstString = 'a constant string';
|
|
|
|
|
|
|
|
|
|
var aNum = 0;
|
|
|
|
|
var aBool = true;
|
|
|
|
|
var aString = 'a string';
|
|
|
|
|
const aConstList = [1, 2, 3];
|
|
|
|
|
|
|
|
|
|
const validConstString = '$aConstNum $aConstBool $aConstString';
|
|
|
|
|
// const invalidConstString = '$aNum $aBool $aString $aConstList';
|
|
|
|
|
print("validConstString: $validConstString");
|
|
|
|
|
print("$aNum $aBool $aString $aConstList, ${aConstList[0]}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("\nDart List:");
|
|
|
|
|
// List & Generics(泛型)
|
|
|
|
|
List<String> fruits = ['bananas', 'grapes', 'oranges'];
|
|
|
|
|