Jürgen Krämer-4 wrote:
>
>
> Hi,
>
> Andy Wokula wrote:
>> juliet_w schrieb:
>>> Hi guys,
> .....
>> :echo 'tot is ' . eval(hi . 1700)
>> :echo 'tot is ' . eval(hi . '1700')
>> :echo 'tot is ' . eval('10+1700')
>> :echo 'tot is ' . 1710
>> :echo 'tot is ' . '1710'
>> :echo 'tot is 1710'
>> tot is 1710
>
> this would be the correct result. What I think happens is, because of
> the equal precedence of "." and "+", "." and "+" are evaluated from left
> to right:
>
> :echo 'tot is ' . eval(hi . 100+400+kk+200)
> :echo 'tot is ' . eval((hi . 100)+400+kk+200)
> :echo 'tot is ' . eval(('10+100')+400+kk+200)
> :echo 'tot is ' . eval( 10 +400+kk+200))
> :echo 'tot is ' . 1610
> :echo 'tot is ' . '1610'
> :echo 'tot is 1610'
> tot is 1710
>
> Regards,
> Jürgen
>
>
Thanks a lot Andy and Jürgen,
I understand now.
It is not an eval issue but a string to number conversion problem.
Cheers
Juliet
--
View this message in context:
http://old.nabble.com/eval-results-tp26635814p26674743.html
Sent from the Vim - General mailing list archive at Nabble.com.
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php