Results 1 to 4 of 4

Thread: Difference between Switch and case

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Answers
    6

    Difference between Switch.. Case 1: and Case 1:

    What is the difference between
    Switch (option)
    case '1':
    {
    ----
    }

    and
    case 1:
    {
    ---
    }
    ?? Why is the quotations given for cases??


    Last edited by lathauv; 06-03-2011 at 03:45 AM.

  2. #2
    Moderator
    Join Date
    Oct 2005
    Answers
    305

    Re: Difference between Switch and case

    case '1' is used when option is a string
    case 1 is used when option is an integer


  3. #3
    Junior Member
    Join Date
    Jun 2011
    Answers
    6

    Re: Difference between Switch and case

    thanks for the reply..


  4. #4
    Junior Member
    Join Date
    Dec 2011
    Answers
    3

    Re: Difference between Switch and case

    The single quote for string and normal number is for an integer option. This convention is same like C language.


  5.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact