Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Named-parameters/Ecstasy/named-parameters.ecstasy
Normal file
18
Task/Named-parameters/Ecstasy/named-parameters.ecstasy
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
module NamedParams {
|
||||
const Point(Int x, Int y) {
|
||||
Point with(Int? x=Null, Int? y=Null) {
|
||||
return new Point(x ?: this.x, y ?: this.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject Console console;
|
||||
|
||||
void run() {
|
||||
Point origin = new Point(0, 0);
|
||||
console.print($"origin={origin}");
|
||||
Point moveRight = origin.with(x=5);
|
||||
console.print($"moveRight(x=5)={moveRight}");
|
||||
Point moveUp = moveRight.with(y=3);
|
||||
console.print($"moveUp(y=3)={moveUp}");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue