Jump to content

Apply a callback to an array: Difference between revisions

no edit summary
m (→‎{{header|REXX}}: removed OVERFLOW from PRE html tag.)
No edit summary
Line 834:
6
</lang>
 
 
=={{header|ERRE}}==
<lang>
PROGRAM CALLBACK
 
!
! for rosettacode.org
!
 
DIM A[5]
 
FUNCTION CBACK(X)
CBACK=2*X-1
END FUNCTION
 
PROCEDURE PROCMAP(ZETA,DUMMY(X)->OUTP)
OUTP=DUMMY(ZETA)
END PROCEDURE
 
BEGIN
A[1]=1 A[2]=2 A[3]=3 A[4]=4 A[5]=5
FOR I%=1 TO 5 DO
PROCMAP(A[I%],CBACK(X)->OUTP)
PRINT(OUTP;)
END FOR
PRINT
END PROGRAM
</lang>
This example shows how to pass a function to a procedure.
{{Out}}
<pre>
1 3 5 7 9
</pre>
 
=={{header|Euphoria}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.