March 2019
Intermediate to advanced
208 pages
5h 11m
English
Now that you know your way around compiling and running a program, let’s create a program that uses variables and performs calculations. Specifically, we’ll write a program that calculates a total price, given a quantity and per-unit price. From this point on, we’ll be using examples from the code samples accompanying this book, downloadable from the Pragmatic Programmers website.
| | let qty = 7; |
| | let price = 15; |
| | let total = qty * price; |
| | Js.log2("The total price is $", total); |
This code introduces variables. Variable names in ReasonML, like those in many other programming languages, must begin with a lowercase letter and may be followed ...
Read now
Unlock full access