Greatest element of a list: Difference between revisions
Content deleted Content added
→{{header|Zig}}: format, make example generic, annotate versions |
PascalABC.NET |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 998:
160 PRINT "THE MAXIMUM VALUE WAS ";C;" AT INDEX ";I;"."
170 END</syntaxhighlight>
==={{header|IS-BASIC}}===▼
<syntaxhighlight lang="is-basic">1000 DEF FINDMAX(REF ARR)▼
1010 LET MX=ARR(LBOUND(ARR))▼
1020 FOR I=LBOUND(ARR)+1 TO UBOUND(ARR)▼
1030 LET MX=MAX(MX,ARR(I))▼
1040 NEXT▼
1050 LET FINDMAX=MX▼
1060 END DEF</syntaxhighlight>▼
==={{header|MSX Basic}}===
Line 1,031 ⟶ 1,040:
130 PRINT "The maximum value was "; c; " at index "; i; "."
140 END</syntaxhighlight>
==={{header|SmallBASIC}}===
list = [1,1234,62,234,12,34,6]
print max(list)
</syntaxhighlight>▼
=={{header|Batch File}}==
Line 1,847 ⟶ 1,862:
=={{header|Euler}}==
Euler allows hetrogenous lists, the <code>real</code> operator converts boolean and symbol (short character strings) to a number (leaving numeric values unchanged) and the <code>isu</code> operator tests whether its operand is <code>undefined</code> or not.
'''begin''' '''new''' greatest;
▲<syntaxhighlight lang="euler">
'''begin''' '''new''' L; '''new''' i; '''new''' result; '''label''' iLoop;
iLoop: '''if''' [ i
'''goto'''
'''end''' '''else'''
'''out''' greatest( ( '''false''', 99.0, -271, "b", 3, 4 )
'''end''' $▼
▲end $
▲</syntaxhighlight>
=={{header|Euler Math Toolbox}}==
Line 2,482 ⟶ 2,495:
4
</pre>
▲=={{header|IS-BASIC}}==
▲<syntaxhighlight lang="is-basic">1000 DEF FINDMAX(REF ARR)
▲1010 LET MX=ARR(LBOUND(ARR))
▲1020 FOR I=LBOUND(ARR)+1 TO UBOUND(ARR)
▲1030 LET MX=MAX(MX,ARR(I))
▲1040 NEXT
▲1050 LET FINDMAX=MX
▲1060 END DEF</syntaxhighlight>
=={{header|J}}==
Line 3,819 ⟶ 3,823:
FindMaxInt 999999 @ 691620
FindMaxFlt 999999.0265 @ 14824</pre>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
var values := Lst(1,7,4,6,3,5,2,6);
values.Max.Print;
</syntaxhighlight>
=={{header|Perl}}==
Line 4,756 ⟶ 4,767:
=={{header|Wren}}==
<syntaxhighlight lang="
var a = [42, 7, -5, 11.7, 58, 22.31, 59, -18]
|