Help for this page

Select Code to Download


  1. or download this
    sub fib {
      my $nth = shift;
      return $nth if $nth <= 1;
      return fib( $nth - 1 ) + fib( $nth - 2 );
    }
    
  2. or download this
    sub fib {
      croak("…")  if @_ != 1;
    ...
      return $nth if $nth <= 1;
      return fib( $nth - 1 ) + fib( $nth - 2 );
    }
    
  3. or download this
    sub fib(UInt $nth) {
      return $nth if $nth <= 1;
      return fib( $nth - 1 ) + fib( $nth - 2 )
    }
    
  4. or download this
    class Point
        attr_accessor :x
    ...
            return Point.new @y, @x
        end
    end
    
  5. or download this
    class Point {
      public $x, $y;
    ...
      }
    
    }
    
  6. or download this
    class Point:
        def __init__(self, x, y):
    ...
    
        def inverted(self):
            return Point(self.y,self.x)
    
  7. or download this
    package Point;
    use Carp 'croak';
    ...
    }
    
    1;
    
  8. or download this
    class Point {
        has Num ($x, $y);
    ...
            return Point->new( x => $y, y => $x );
        }
    }
    
  9. or download this
    class Cache::LRU {
        use Hash::Ordered;
    ...
            return $x->set( $key, $x->delete($key) );
        }
    }
    
  10. or download this
    package Cache::LRU {
        use Hash::Ordered;
    ...
    
        __PACKAGE__->meta->make_immutable;
    }