Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Syntax problem

Syntax problem

Scheduled Pinned Locked Moved C#
helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    psamy
    wrote on last edited by
    #1

    Hi , anyone please help me how to make multiple scenorio in case. i tried with , operator but it gives error. example, switch(a) { case q,y: ... }

    R 1 Reply Last reply
    0
    • P psamy

      Hi , anyone please help me how to make multiple scenorio in case. i tried with , operator but it gives error. example, switch(a) { case q,y: ... }

      R Offline
      R Offline
      rah_sin
      wrote on last edited by
      #2

      try switch(a) { case q: case y: { ur calculations......(it should work for both case q and case y) } break; ... }

      rahul

      E 1 Reply Last reply
      0
      • R rah_sin

        try switch(a) { case q: case y: { ur calculations......(it should work for both case q and case y) } break; ... }

        rahul

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #3

        You don't need the additional body! {} wastes some time and is often unnecessary. (I bet it pushes and pops the stack)

        switch(a){
        case q:
        case y:
        ...
        break;
        }

        A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups