Re: [PBML] Help please , thanks in advance
- there are 2 errors in your code... this is the first one :
: : my $target = rand()*3;
when you use rand, the result will be a floating point number
( say 1.857493 ) so you have to use "int" :
my $target = int (rand()*3);
so "int ( 1.857493 )" will be " 1 ";
and this is the seccond mistake :
:: $userchoice eq <>;
"eq" means "is it equal ?" when you want to say "make it equal"
you have to use " = " instead...
$userchoice = <>;
and your programmed will work great :
This is the classic game Rock Paper Scissors
> rockjadi : rock cpu : 2
Computer picked SCISSORS you win!!
as you can see I've added some more lines and \n to it !