Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 527

Compile a one file ocaml program with a module and a main method

$
0
0

I somehow can't install a working OCaml environment on my Windows computer. I want to use know the OCaml online compiler. Problem: I can only write one file there and put everything in that one file:

module Atom = struct  let hello name = print_string ( "Hello " ^ name );;endprint_string "Hello, World!";Atom.hello "Florian";

The above code produces the error:

Output:
File "./HelloWorld.ml", line 7, characters 0-12:7 | print_string "Hello, World!";    ^^^^^^^^^^^^Error: Syntax error

Without the module Atom stuff, the print_string works! Is it not possible to define a module at the top of the file. Or where is the syntax error?


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>