Function definition: Difference between revisions
Content added Content deleted
m (→{{header|Chipmunk Basic}}: Function defined as formula. An obsolete way - does not work properly with integer formal parameters (e.g. x%).) |
(Add Ecstasy example) |
||
Line 1,413: | Line 1,413: | ||
multiply → (λ (_a _b) (#🔶_multiply)) ;; compiled function |
multiply → (λ (_a _b) (#🔶_multiply)) ;; compiled function |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Ecstasy}}== |
|||
<syntaxhighlight lang="java">module MultiplyExample |
|||
{ |
|||
static <Value extends Number> Value multiply(Value n1, Value n2) |
|||
{ |
|||
return n1 * n2; |
|||
} |
|||
void run() |
|||
{ |
|||
(Int i1, Int i2) = (7, 3); |
|||
Int i3 = multiply(i1, i2); |
|||
(Double d1, Double d2) = (2.7182818, 3.1415); |
|||
Double d3 = multiply(d1, d2); |
|||
@Inject Console console; |
|||
console.println($"{i1}*{i2}={i3}, {d1}*{d2}={d3}"); |
|||
// output: "7*3=21, 2.7182818*3.1415=8.539482274700001" |
|||
} |
|||
}</syntaxhighlight> |
|||
=={{header|Efene}}== |
=={{header|Efene}}== |