rse2 has asked for the wisdom of the Perl Monks concerning the following question:
Hey there! i have to make a program of mine loop.
Do you have any ideas on the condition in the loop i can put?
by the way i have to make this program loop.
#! /usr/bin/perl -w print "Type in a number: "; $x = <>; print "Type in another number: "; $y = <>; print "What would you like done?\n\nYour choice is:\n1) Add\n2) Subtra +ct\n3) Multiply\n4) Divide\n"; $ask = <>; chomp ($ask); if ($ask eq "Add") { print $x + $y,"\n";} if ($ask eq "Subtract") { print $x - $y,"\n";} if ($ask eq "Divide") { print $x / $y, "\n";} if ($ask eq "Multiply") { print $x * $y, "\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: any loop ideas?
by moritz (Cardinal) on Aug 18, 2011 at 13:25 UTC | |
|
Re: any loop ideas?
by blue_cowdawg (Monsignor) on Aug 18, 2011 at 13:50 UTC | |
|
Re: any loop ideas?
by planetscape (Chancellor) on Aug 18, 2011 at 21:23 UTC | |
|
Re: any loop ideas?
by raybies (Chaplain) on Aug 18, 2011 at 16:27 UTC |