Jump to content

Apply a callback to an array: Difference between revisions

no edit summary
No edit summary
Line 361:
Output:
<pre>[6, 7, 8, 9, 10]</pre>
 
=={{header|Delphi}}==
<lang Delphi>
// Declare the callback function
procedure callback(const AInt:Integer);
begin
WriteLn(AInt);
end;
 
const
// Declare a static array
myArray:Array[0..4] of Integer=(1,4,6,8,7);
var
// Declare interator variable
i:Integer;
begin
// Iterate the array and apply callback
for i:=0 to length(myArray)-1 do
callback(myArray[i]);
end.
</lang>
 
 
=={{header|E}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.