|
@@ -80,7 +80,7 @@ todo add examples
|
|
|
|
|
|
## 2.4 Pattern Matching at functions too (like in Erlang)
|
|
## 2.4 Pattern Matching at functions too (like in Erlang)
|
|
Function overloading in dlang allows to define the same function but with different versions for different data types:
|
|
Function overloading in dlang allows to define the same function but with different versions for different data types:
|
|
-```dlang
|
|
|
|
|
|
+```
|
|
int my_func(int x){
|
|
int my_func(int x){
|
|
return x;
|
|
return x;
|
|
}
|
|
}
|
|
@@ -103,7 +103,7 @@ my_func(9) -> 9 * 3;
|
|
my_func(X) -> X * 4.
|
|
my_func(X) -> X * 4.
|
|
```
|
|
```
|
|
->
|
|
->
|
|
-```dlang
|
|
|
|
|
|
+```
|
|
int my_func(int x){
|
|
int my_func(int x){
|
|
if(x == 1){
|
|
if(x == 1){
|
|
return 1;
|
|
return 1;
|
|
@@ -386,9 +386,7 @@ switch(x){
|
|
```
|
|
```
|
|
|
|
|
|
todo more examples -- with switch case dlang
|
|
todo more examples -- with switch case dlang
|
|
-```
|
|
|
|
|
|
|
|
-```
|
|
|
|
|
|
|
|
## 2.5 aliases for imports, externs etc
|
|
## 2.5 aliases for imports, externs etc
|
|
```
|
|
```
|