Maximum difference between adjacent elements of list: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added code to align the output element pairs (for the maximum difference).) |
m (→{{header|REXX}}: changed whitespace, moved a statement.) |
||
Line 436: | Line 436: | ||
@.i= x; w= max(w, length(x) ) /*assign element #; find maximum width.*/ |
@.i= x; w= max(w, length(x) ) /*assign element #; find maximum width.*/ |
||
if datatype(x, 'N') then iterate /*Is it numeric? Yes, then continue. */ |
if datatype(x, 'N') then iterate /*Is it numeric? Yes, then continue. */ |
||
say '***error*** element #'i " isn't numeric: " x |
say '***error*** element #'i " isn't numeric: " x |
||
exit 13 |
exit 13 |
||
end /*i*/ |
end /*i*/ |
||
⚫ | |||
if #<2 then do; say '***error*** not enough elements were specified, minimum is two.' |
if #<2 then do; say '***error*** not enough elements were specified, minimum is two.' |
||
exit 13 |
exit 13 |
||
end |
end |
||
⚫ | |||
say ' list of elements: ' space($) /*show the list of numbers in list.*/ |
say ' list of elements: ' space($) /*show the list of numbers in list.*/ |
||
say ' number of elements: ' # /*show " number " elements " " */ |
say ' number of elements: ' # /*show " number " elements " " */ |