Re: why is 4 the outcome ?
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <CAJMfKEXyzhZLUzet07fRo0hUFJk6zqwuo5YzhZe6tHJDysme+w@mail.gmail.com> |
On Wed, Oct 15, 2014 at 2:17 PM, Roelof Wobben [email protected] [ocaml_beginners] <[email protected]> wrote: > > > Hello, > > I have this programm : > > let x = 1 in let x = 2 in x + x > > I was expected to see a outcome of 3 but when I run it I see a outcome > of 4 , > > Can someone explain to me why ?? > If x is an integer, then x + x = 2 * x is an even number. 3 is not an even number so it cannot be equal to x + x for any x. Since x = 2, therefore x + x = 2 + 2 = 4. Regards.