[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dangling number producing strange display
From: |
Richard Crozier |
Subject: |
Re: dangling number producing strange display |
Date: |
Wed, 04 Dec 2013 18:13:19 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
On 04/12/2013 18:07, CdeMills wrote:
Hello,
I had a hard time understanding the following behaviour:
x = 0
for indi=(1:10) 120
x=x+1;
end
during execution, I got:
ans = 120 [repeated 10 times]
The dangling '120' was introduced by accident while modifying some file. Is
it legal syntax ? What is the behaviour under MatLab ?
Regards
Pascal
legal in Matlab, equivalent to just writing
for indi=(1:10)
120
x=x+1;
end
In ML
>> x = 0
for indi=(1:10) 120
x=x+1;
end
x =
0.0000e+000
ans =
120.0000e+000
ans =
120.0000e+000
<snip>
ans =
120.0000e+000
ans =
120.0000e+000
>> x
x =
10.0000e+000
Richard
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.