Function definition: Difference between revisions

Content added Content deleted
mNo edit summary
Line 1,442: Line 1,442:
=={{header|Ecstasy}}==
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
module MultiplyExample
module MultiplyExample {
static <Value extends Number> Value multiply(Value n1, Value n2) {
{
static <Value extends Number> Value multiply(Value n1, Value n2)
{
return n1 * n2;
return n1 * n2;
}
}


void run()
void run() {
{
(Int i1, Int i2) = (7, 3);
(Int i1, Int i2) = (7, 3);
Int i3 = multiply(i1, i2);
Int i3 = multiply(i1, i2);
Line 1,457: Line 1,454:
@Inject Console console;
@Inject Console console;
console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
console.print($"{i1}*{i2}={i3}, {d1}*{d2}={d3}");
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>