Declaration syntax

Tobias Pankrath tobias at pankrath.net
Wed Jan 8 13:13:40 PST 2014


>> x : Int = 4
>> h = sqrt(x * x)
>>
>> Is 'h' a function or is it 2? Should h change if I change x?
>
> if you showed the line
>
> h = sqrt(x*x)
>
> to 100 people, either programmers or people familiar with 
> algebra, how many
> do you think would say that 'h' is a variable and how many do 
> you think
> would say 'h' is a function?
>
> And FWIW the square root of 4*4 is 4 not 2.

Value, all of them. I know any calculus/syntax where it would be 
different. The only difference I am aware of is whether a change 
of x propagates to h.


More information about the Digitalmars-d mailing list