Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
how to print (or cast) an integer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] how to print (or cast) an integer
> Also note you do not need "and". That is only required when the variables
> being defined are mutually recursive. It would be better style to write:
> let x = 1;;
> let y = 2;;

The style aspect of your comment is a definite matter of opinion![*]

Given that this is a beginner question, it's probably worth clarifying that
in the context of "let .. and .. ;;" or "let .. and .. in ..;;" the "and" is
a shorthand allowing you to group multiple lets together without introducing
a new environment.

"and" only provides mutually recursive definitions in a "let rec" statement.


[*] I personally find it neater to group a series of definitions at the same
level using "let .. and .. in" and only use let again for nested definitions
but that's because I indent code after an "in" but I think that my indenting
scheme is somewhat less common...