Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/opt/rakudo-pkg/bin/perl6
- # printf "%s \n", 10/2/2.5;
- my @aNumlist = <4 9 16 25>;
- #printf "%s \n", @aNumlist.elems;
- #say @aNumlist;
- class DoComputations {
- #has Int $x
- #method addValue(Int myValue) {
- method addValue( $myValue ) {
- #return $myValue + $myValue;
- return $myValue;
- }
- }
- my $tmp = DoComputations.new;
- #printf "%s \n", $tmp.addValue ();
- #say DoComputations.new.addValue(12);
- #printf "%s \n", DoComputations.addValue:myValue(12);
- say DoComputations.addValue: myValue =>12;
- ===== OUTPUTS ====
- Too few positionals passed; expected 2 arguments but got 1
- in method addValue at ./lambada.pl line 14
- in block <unit> at ./lambada.pl line 28
- === QUESTION HOW DO I PASS A VALUE TO A METHOD OF A CLASS? ===
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement