out contract misunderstanding (was: I cannot understand problem with argument of the function)
mrd
denis.feklushkin at gmail.com
Thu Sep 19 01:17:07 PDT 2013
On Thursday, 19 September 2013 at 06:39:09 UTC, Ivan Kazmenko
wrote:
> On Thursday, 19 September 2013 at 01:41:15 UTC, mrd wrote:
>> $ ./bug
>> body, value=2
>> out contract, value=0
>>
>> Why argument "value" in contract isn't equal 2 ?
>
> Why should it be? value is a mutable argument, and the out
> contract evaluates it at the return point, which is after it's
> set to 0. It is no different than using value in the body just
> before the return point.
Why? it seems the documentation does not say anything about it.
Using variables values from another {} block is confusing.
More information about the Digitalmars-d-learn
mailing list