Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Rosetta Code Error or $n // 100

by pgmer6809 (Sexton)
on Mar 24, 2019 at 19:58 UTC ( #1231622=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub continued_fraction {
        my ($a, $b, $n) = (@_[0,1], $_[2] // 100);  
    #<========= what is $_[2] // 100 ??
    ...
    printf "e   &#8776; %.9f\n", continued_fraction do { my $n; sub { $n++
    + || 2 } }, do { my $n; sub { $n++ || 1 } }; # <===== Note there is no
    + third arg passed
    printf "&#960;   &#8776; %.9f\n", continued_fraction do { my $n; sub {
    + $n++ ? 6 : 3 } }, do { my $n; sub { (2*$n++ + 1)**2 } }, 1_000; #<==
    +== Here there is a 3rd arg
    printf "&#960;/2 &#8776; %.9f\n", continued_fraction do { my $n; sub {
    + 1/($n++ || 1) } }, sub { 1 }, 1_000; #<==== Here there is a 3rd arg
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1231622]
Approved by Perlbotics
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2022-08-11 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?