summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSridhar Easwaran <sridhar.1788@gmail.com>2019-10-11 20:29:26 +0530
committerGitHub <noreply@github.com>2019-10-11 20:29:26 +0530
commitcbf8a43ca14fe063b42f2d7a209a6f7139e7cd5e (patch)
treee8ebf3873c55d39c48853e9316d168d9f93efa0a
parentf0eb830ebded612e53eef019776d6573fbc42ab0 (diff)
Add example for Optional Positional Parameter
-rw-r--r--dart.html.markdown13
1 files changed, 12 insertions, 1 deletions
diff --git a/dart.html.markdown b/dart.html.markdown
index 07f755f7..fb1856fd 100644
--- a/dart.html.markdown
+++ b/dart.html.markdown
@@ -503,6 +503,17 @@ example30() {
}
}
+// Optional Positional Parameter
+// parameter will be disclosed with square bracket [ ] & square bracketed parameter are optional.
+example31() {
+ findVolume(int length, int breath, [int height]) {
+ print('length = $length, breath = $breath, height = $height');
+ }
+
+ findVolume(10,20,30); //valid
+ findVolume(10,20); //also valid
+}
+
// Programs have only one entry point in the main function.
// Nothing is expected to be executed on the outer scope before a program
// starts running with what's in its main function.
@@ -514,7 +525,7 @@ main() {
example8, example9, example10, example11, example12, example13, example14,
example15, example16, example17, example18, example19, example20,
example21, example22, example23, example24, example25, example26,
- example27, example28, example29, example30
+ example27, example28, example29, example30, example31
].forEach((ef) => ef());
}