mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-23 14:50:58 +00:00
Updated example 8
Updated const declaration and removed print addressing missing array.
This commit is contained in:
parent
9e975a8dcf
commit
cfb3473396
@ -198,7 +198,7 @@ class GenericExample<T>{
|
|||||||
/// or outside of class have to be constant. Strings and numbers are constant
|
/// or outside of class have to be constant. Strings and numbers are constant
|
||||||
/// by default. But arrays and maps are not. They can be made constant by
|
/// by default. But arrays and maps are not. They can be made constant by
|
||||||
/// declaring them "const". Kind of similar to Javascript's Object.freeze()
|
/// declaring them "const". Kind of similar to Javascript's Object.freeze()
|
||||||
const example8List = ["Example8 const array"],
|
const example8List = ["Example8 const array"];
|
||||||
const example8Map = {"someKey": "Example8 const map"};
|
const example8Map = {"someKey": "Example8 const map"};
|
||||||
/// Declare List or Maps as Objects.
|
/// Declare List or Maps as Objects.
|
||||||
List<String> explicitList = new List<String>();
|
List<String> explicitList = new List<String>();
|
||||||
@ -206,7 +206,6 @@ const example8Map = {"someKey": "Example8 const map"};
|
|||||||
|
|
||||||
explicitList.add("SomeArray");
|
explicitList.add("SomeArray");
|
||||||
example8() {
|
example8() {
|
||||||
print(example8Array[0]);
|
|
||||||
print(example8Map["someKey"]);
|
print(example8Map["someKey"]);
|
||||||
print(explicitList[0]);
|
print(explicitList[0]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user