Welcome to this first part of the OCaml course!
(* This is OCaml code *)
print_endline "Hello, world!";;
Let’s explain this first sheet of code. What is between (*
and *)
is a comment. It is not executed and is here to add awesome explaination about the code. Then there is a print_endline
: it is a built-in function printing a string to the screen with a return character to go to the next line. Then what is between quotation marks ("
) is the String which will be printed to the screen. Finally, the ;;
end the statement and return the last think on the stack. (here it is unit, we will details that later)
You can try to execute this code in the app, and see what is does. When you are ready, you can go to the next chapter about variables to start learning OCaml basics.