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

When can I take given as read?

Thread Next
From:
Piers Cawley
Date:
June 16, 2005 20:42
Subject:
When can I take given as read?
Message ID:
m28y19ir9a.fsf@obelisk.bofh.org.uk
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About