Quantcast
Channel: Flexible switch case syntax - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Flexible switch case syntax

$
0
0

My entire program is similar to that of command prompt. Currently, I'm writing a function that appends a word entered by a user to a particular file. The user must follow appropriate syntax. By typing in:

APP C Now

the program will append the word "Now" to the file C.

By typing in:

APP C She

the program will append the word "She" to the file C.

I have a number of choices which I've all put into a switch statement. Example:

case "ADD C":case "DEL C":

My other cases including the two above are working perfectly fine. My question is, how would I make a switch case for this format? i.e. "APP C word"


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>