input 받아 output 내면 함수
let calculator (input_one:int) (input_two:int):int =
input_one*input_two;;
print_int (calculator 3 5);;
@martini:~$ ocaml function.ml
15
let calculator (input_one:int) (input_two:int):int=
let product = input_one * input_two in
product + 1;;
print_int (calculator 3 5);;
martini:~$ ocaml function_two.ml
16
'Computer Science > 프로그래밍언어' 카테고리의 다른 글
OCaml Tutorial | Introduction to Lists (0) | 2022.03.08 |
---|---|
OCaml Tutorial | Introduction to Pattern Matching (0) | 2022.03.08 |
OCaml Tutorial | Introduction to Variables (0) | 2022.03.08 |
OCaml Tutorial | Conditional Statements (0) | 2022.03.08 |
OCaml Tutorial | Primitives and Expressions (0) | 2022.03.08 |