summaryrefslogtreecommitdiffstats
path: root/ocamlbuild/examples/example2
diff options
context:
space:
mode:
authorNicolas Pouillard <np@nicolaspouillard.fr>2007-02-07 08:59:16 +0000
committerNicolas Pouillard <np@nicolaspouillard.fr>2007-02-07 08:59:16 +0000
commit381e325c0f7c9f4188c2a4e6421b46d41c0c007c (patch)
tree194fbc6442deb3d79b6c595f30f356ed58f063cb /ocamlbuild/examples/example2
parent2d26308ad4d34ea0c00e44db62c4c24c7031c78c (diff)
Add the ocamlbuild directory
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7823 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamlbuild/examples/example2')
-rw-r--r--ocamlbuild/examples/example2/greet.ml6
-rw-r--r--ocamlbuild/examples/example2/hello.ml14
2 files changed, 20 insertions, 0 deletions
diff --git a/ocamlbuild/examples/example2/greet.ml b/ocamlbuild/examples/example2/greet.ml
new file mode 100644
index 000000000..ec8088916
--- /dev/null
+++ b/ocamlbuild/examples/example2/greet.ml
@@ -0,0 +1,6 @@
+type how = Nicely | Badly;;
+
+let greet how who =
+ match how with Nicely -> Printf.printf "Hello, %s !\n" who
+ | Badly -> Printf.printf "Oh, here is that %s again.\n" who
+;;
diff --git a/ocamlbuild/examples/example2/hello.ml b/ocamlbuild/examples/example2/hello.ml
new file mode 100644
index 000000000..b48806a3d
--- /dev/null
+++ b/ocamlbuild/examples/example2/hello.ml
@@ -0,0 +1,14 @@
+open Greet
+
+let _ =
+ let name =
+ if Array.length Sys.argv > 1 then
+ Sys.argv.(1)
+ else
+ "stranger"
+ in
+ greet
+ (if name = "Caesar" then Nicely else Badly)
+ name;
+ Printf.printf "My name is %s\n" Sys.argv.(0)
+;;