vault backup: 2023-09-05 15:26:39
This commit is contained in:
parent
053d5c2f60
commit
e4b01f109a
@ -75,3 +75,17 @@ _: int = 4 (*same things but with another method*)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## 2.3. Function with several parameters (2 or more)
|
## 2.3. Function with several parameters (2 or more)
|
||||||
|
|
||||||
|
```Ocaml
|
||||||
|
(*The logic way (for us)*)
|
||||||
|
# let average(a,b) = (a+b)/2 ;;
|
||||||
|
val average: int*int -> int = <fun>
|
||||||
|
|
||||||
|
(*This method is not for several parameter, is just a one parameter wich is a couple*)
|
||||||
|
|
||||||
|
(*The OCaml way (the way that it work) *)
|
||||||
|
# let average a b = (a+b)/2;;
|
||||||
|
val average: int -> int -> int = <fun>
|
||||||
|
# average (-2) (2);;
|
||||||
|
-: int = 0
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user