ScoobyDood
Programmer
Ok, I was working in this script (It's a logic riddle by the way) that looked something like this: (In part)
#Script starts here
$food=cgiobject->param("food"
;
if ($food==Pizza)
print {"No, the answer was Cheese Stix!";}
elsif ($food==Cheese Stix)
print ("That is correct!";}
else
print {"That was not a choice!";}
#Script ends here
Well, it didn't work! No matter what you typed in, it said "No, the answer was Cheese Stix!". So then I did this, and you had to type in either choice 1 or choice 2:
#Script starts here
$food=cgiobject->param("food"
;
if ($food==1)
print {"No, the answer was Cheese Stix!";}
elsif ($food==2)
print ("That is correct!";}
else
print {"That was not a choice!";}
#Script ends here
And it worked! It gets the job done, but it's just not the same. So what's the deal? Can IF statements only represent numbers? If so, what kind of script can I use to meet my needs? Thanks. Computers - Can't live with 'em, can't live without 'em! Check this out:
#Script starts here
$food=cgiobject->param("food"
if ($food==Pizza)
print {"No, the answer was Cheese Stix!";}
elsif ($food==Cheese Stix)
print ("That is correct!";}
else
print {"That was not a choice!";}
#Script ends here
Well, it didn't work! No matter what you typed in, it said "No, the answer was Cheese Stix!". So then I did this, and you had to type in either choice 1 or choice 2:
#Script starts here
$food=cgiobject->param("food"
if ($food==1)
print {"No, the answer was Cheese Stix!";}
elsif ($food==2)
print ("That is correct!";}
else
print {"That was not a choice!";}
#Script ends here
And it worked! It gets the job done, but it's just not the same. So what's the deal? Can IF statements only represent numbers? If so, what kind of script can I use to meet my needs? Thanks. Computers - Can't live with 'em, can't live without 'em! Check this out: