Talk:Loops/Nested: Difference between revisions

m
→‎Task Clarification: fixed some typos, reinstated intended whitespace.
(added a query about numbers versus integers. -- ~~~~)
 
m (→‎Task Clarification: fixed some typos, reinstated intended whitespace.)
 
(3 intermediate revisions by 2 users not shown)
Line 1:
==taskTask clarificationClarification==
 
When the task description said numbers from   1..20,   did it mean integers?
<br>If not, the REXX example could also use numbers with decimal parts.
<br>Some languages (like REXX) can handle both at the same time.
 
<br>
<br>Also, it wasn't stated explicityexplicitly, but I assume the array could be fully populated, but without an element being equal to "20". &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] 02:54, 15 May 2012 (UTC)
: I'd assume it meant integers; if not, the likelihood of encountering a “20” is too small. (Yes, it could be implemented otherwise, but what would be the point of that?) Another reason for assuming integer is that it says <math>[1\ldots 20]</math> and not <math>[1.0\ldots 20.0]</math> –[[User:Dkf|Donal Fellows]] 10:23, 15 May 2012 (UTC)
 
:: The point that I was asking for clarification. &nbsp; If the task was to use integers, then just say so. &nbsp; Otherwise, it's a matter of assumptions, and programs based on assumptions more often than not, make the wrong assumptions. &nbsp; In most languages, if the array is declared to be integer, then that's what's stored. &nbsp; Most examples generated their own arrays, so the programmer knows what to expect, so whatever the programmer assumed is what's stored in that array. &nbsp; There's no possibility of anything else stored there {except for a possible &nbsp; ''not defined/assigned'' &nbsp; or &nbsp; ''integer-out-of-range'', &nbsp; or some such, if the language supports those kind of things}. &nbsp; In any case, a program shouldn't blindly assume that there &nbsp; ''is'' &nbsp; a value of &nbsp; '''20''' &nbsp; in the array (no mention in the task was made about the array's size, although it did say it was "filled with...", &nbsp; and one could make the assumption that it implies more than none). &nbsp; The number of elements could be zero, five, or five thousand. &nbsp; I'd rather see a good example than one that made too many assumptions. &nbsp; 9.5 &nbsp; is still between &nbsp; 1 and 20. &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] 14:50, 15 May 2012 (UTC)