System not seeing my cases


#1


https://www.codecademy.com/courses/web-beginner-en-jZv2E/0/6?curriculum_id=5124ef4c78d510dd89003eb8

code works but the system keeps telling i must have at least 3 cases


 $picker = "1";
    
    switch ($picker){
        
        case 1:
            echo "A pickle is smarter";
        break; 
        
        case 2;
            echo "Your getting better";
        break;
        
        case 3;
            echo "Bright as a dead star";
        break;
        
        case 4;
            echo "Yeah right your not this smart";
        
        default:
            echo "You Cheating Bastard";        
        
    }


#2

Yes you will always get the default output because


$picker does not match any of the cases you are checking for. That variable contains a string but you are checking for numbers.
Perhaps you should change the $picker value to an integer and it will work.


#3

that is not the problem please read the post the code works fine codeacademy system is not seeing the cases and returns an error that says must have at least 3 cases and i am stuck and cannot continue. I removed the quotes and the same thing happens.


#4

See comments

 $picker = "1";
    
    switch ($picker){
        
        case 1:
            echo "A pickle is smarter";
        break; 
        
        case 2;  // remove semicolon and set a colon
            echo "Your getting better";
        break;
        
        case 3;  // remove semicolon and set a colon
            echo "Bright as a dead star";
        break;
        
        case 4;  // remove semicolon and set a colon
            echo "Yeah right your not this smart";
        
        default:
            echo "You Cheating Bastard";        
        
    }

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.