Computer Science/프로그래밍언어

OCaml Tutorial | Introduction to Variables

토마토. 2022. 3. 8. 18:10

 

ocaml
        OCaml version 4.08.1

# let variable_name = 5;;
val variable_name : int = 5
# variable_name;;
- : int = 5
# variable_name+1;;
- : int = 6
# let first_input = 4;;
val first_input : int = 4
# let second_input = 6;;
val second_input : int = 6
# first_input * second_input;;
- : int = 24
# let first_input = 5;;
val first_input : int = 5
# let product = first_input * second_input;;
val product : int = 30
# let first_input = 4;;
val first_input : int = 4
# product;;
- : int = 30
# let b = true;;
val b : bool = true
# b;;
- : bool = true

주의**

재할당하려면 

let second_input = 6;;처럼 해주어야 한다.