summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Yankov <golergka@gmail.com>2013-08-17 23:09:07 +0200
committerMax Yankov <golergka@gmail.com>2013-08-17 23:09:07 +0200
commitdd1a6193605909f3d6abf7795cd18261b27696b9 (patch)
tree0b98cc2f8455e6264af99c76c13ce74616baacfc
parentccdc21900d090a88ca02e25007f4e3c197b8f50e (diff)
C#: default parameter values
-rw-r--r--csharp.html.markdown5
1 files changed, 3 insertions, 2 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown
index fefcb0bb..599aaca3 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -482,12 +482,13 @@ namespace Learning
gear = newValue;
}
- public void SpeedUp(int increment)
+ // Method parameters can have defaut values. In this case, methods can be called with these parameters omitted
+ public void SpeedUp(int increment = 1)
{
_speed += increment;
}
- public void SlowDown(int decrement)
+ public void SlowDown(int decrement = 1)
{
_speed -= decrement;
}