A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Switch statement used with multiple values?

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    400

    Switch statement used with multiple values?

    I'm afraid I know the answer but I wanted to check first.

    I want to run a single function based on multiple values.

    Actionscript Code:
    switch (studentNumber)
         case 1,4,8 :
              trace("Good kids");
              break;
         case 2,3,5,6,7 :
              trace("Bad kids");
              break;
         default :
              trace("Neither");
    }

    As always, thanks!

  2. #2
    Member
    Join Date
    Apr 2010
    Posts
    87
    google made us too lazy.

    Actionscript Code:
    switch (studentNumber){
        case 1:
        case 4:
        case 8:
            trace("Good kids");
            break;
        case 2:
        case 3:
        case 5:
        case 6:
        case 7:
            trace("Bad kids");
            break;
        default :
        trace("Neither");
    }

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    400
    Oh I was lazy long before Google!

    Thanks for your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center