Named parameters: Difference between revisions

Content added Content deleted
(Add Ecstasy example)
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag)
Line 603: Line 603:
{
{
Point origin = new Point(0, 0);
Point origin = new Point(0, 0);
console.println($"origin={origin}");
console.print($"origin={origin}");
Point moveRight = origin.with(x=5);
Point moveRight = origin.with(x=5);
console.println($"moveRight(x=5)={moveRight}");
console.print($"moveRight(x=5)={moveRight}");
Point moveUp = moveRight.with(y=3);
Point moveUp = moveRight.with(y=3);
console.println($"moveUp(y=3)={moveUp}");
console.print($"moveUp(y=3)={moveUp}");
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>


{{out}}
Output:
<pre>
<syntaxhighlight>
origin=(x=0, y=0)
origin=(x=0, y=0)
moveRight(x=5)=(x=5, y=0)
moveRight(x=5)=(x=5, y=0)
moveUp(y=3)=(x=5, y=3)
moveUp(y=3)=(x=5, y=3)
</pre>
</syntaxhighlight>


=={{header|Elixir}}==
=={{header|Elixir}}==