Re: why is 4 the outcome ?

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
oke,

I thought I had to read it as follows

let x = 1 the first x in x + x is a 1

let x = 2 so the second x in x + x is a 2 so it will be 1 + 2 =
3

Roelof

Lukasz Stafiniak [email protected] [ocaml_beginners] schreef op
15-10-2014 14:21:

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.

__._,_.___

----------

Posted by: Roelof Wobben <[email protected]>
----------

Reply via web post

•

Reply to sender

•

Reply to group

•

Start a New Topic

•

Messages in this topic
(3)

Archives up to December 31, 2011 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners

The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr

Attachments are banned and you're asked to be polite, avoid flames etc.

Visit Your Group

https://groups.yahoo.com/neo;_ylc=X3oDMTJkaXRyanFtBF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzMzc1OTY1

• Privacy • Unsubscribe • Terms of Use

.

__,_._,___
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.