-
-
Save anonymous/7b86c66589fd5b67feab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Perl 6 | |
class Point { | |
has $.x; | |
has $.y = 2 * $!x; | |
} | |
my $p = Point.new( x => 1, y => 2); | |
# ^^^ inherited from class Mu | |
say "x: ", $p.x; | |
say "y: ", $p.y; | |
# CafeScript | |
class Point | |
@x | |
@y = 2 * @x | |
class main | |
p = Point x: 1, y: 2 | |
say "x: " @p.x | |
say "y: " @p.y | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment