develooper Front page | perl.beginners | Postings from November 2023

Program complete

From:
William Torrez Corea
Date:
November 15, 2023 06:17
Subject:
Program complete
Message ID:
CAGiORHfGTVQ2HWfjj3oBKQUXZ91xXw8iWEoRVRGnMTBOB-bHRw@mail.gmail.com
*What is a complete program or what needs a program to be complete?*

Is a different a program of C in comparison with a program in Perl. In C
the program has a structure but in Perl it is different.

my @numbers = (3,7,9,99,25);
> my @perfect_squares;
>
> # the next statement is useful when you want to skip the processing
> # of some elements. You can use this to rewrite the previous code
> # to find all perfect squares in a loop
> for my $number (@numbers){
>         my $root = sqrt ($number);
>
>         if (int ($root) != $root){
>                 next; #skip the rest of the loop BLOCK
>         }
>
>         print "Found perfect square: $number\n";
>         push @perfect_squares, $number;
> }
> ~
>
> ~
>

-- 

With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀



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