develooper Front page | perl.perl6.language | Postings from June 2005

When can I take given as read?

Thread Next
Piers Cawley
June 16, 2005 20:42
When can I take given as read?
Message ID:
Suppose I have a simple, single argument recursive function:

  sub factorial (Int $n) {
    return 1 if $n == 0;
    return $n * factorial $n;

Can I write that as:

  sub factorial (Int $n:) {
    return 1 when 0;
    return $n * factorial $n;

NB. Yes, I know it's a pathological example.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About