dwyl / learn-dart

๐ŸŽฏLearn the Dart programming language to build cross-platform (Mobile, Web & Desktop) Apps with Flutter!
GNU General Public License v2.0
33 stars 8 forks source link

Update readme with variables section #4

Closed SimonLab closed 4 years ago

SimonLab commented 4 years ago

ref: #3 Add documentation on how to declare and initialise variables with Dart.

SimonLab commented 4 years ago

Thanks @iteles @miguelmartins17 and @nelsonic for all the review! I'll have a look soon at all the comments :+1: I found that having multiple ways to create variables make it harder for beginners to learn the language as you have to already think about the context and situation when writing the code. I'm sure I'll get used to it and in reality only a 1 or 2 keywords are really used.

nelsonic commented 4 years ago

@SimonLab I agree that the Elm way is much better whereby the type annotations are applied once to the function (or inferred by the compiler). But I'm not concerned that a beginner will have any issues learning the different situations where a const is appropriate vs. a var. I don't see us using var very often at all ... in fact given our experience of writing Elm I think we could use const and final exclusively in our code ... and we could even just stick with final everywhere and eliminate any "confusion" altogether. ๐Ÿ’ญ

Thanks for reviewing my review suggestions. ๐Ÿ˜‰

nelsonic commented 4 years ago

As discussed on standup, merging. ๐Ÿ‘