Created
August 20, 2014 14:05
-
-
Save Code-Hex/8824612ec14643852e78 to your computer and use it in GitHub Desktop.
sub で return が省略できることを知った
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
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
my $n = "\n"; | |
my $result = max(10,20); | |
print $result . $n; | |
sub max { | |
my ($a, $b) = @_; | |
$a + $b; #最後に式を持っていけば、自動的に戻り値になる | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment