@@ -479,6 +479,17 @@ example30() {
479479 }
480480}
481481
482+ // Optional Positional Parameter
483+ // parameter will be disclosed with square bracket [ ] & square bracketed parameter are optional.
484+ example31() {
485+ findVolume(int length, int breath, [int height]) {
486+ print('length = $length, breath = $breath, height = $height');
487+ }
488+
489+ findVolume(10,20,30); //valid
490+ findVolume(10,20); //also valid
491+ }
492+
482493// Programs have only one entry point in the main function.
483494// Nothing is expected to be executed on the outer scope before a program
484495// starts running with what's in its main function.
@@ -490,7 +501,7 @@ main() {
490501 example8, example9, example10, example11, example12, example13, example14,
491502 example15, example16, example17, example18, example19, example20,
492503 example21, example22, example23, example24, example25, example26,
493- example27, example28, example29, example30
504+ example27, example28, example29, example30, example31
494505 ].forEach((ef) => ef());
495506}
496507
0 commit comments