Quantcast
Channel: Flexible switch case syntax - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by chrylis -cautiouslyoptimistic- for Flexible switch case syntax

It's typically preferable to use a lookup table and polymorphism instead of a conditional (if or switch) when practical. It's particularly helpful in a case like this, where your different commands are...

View Article


Answer by nhouser9 for Flexible switch case syntax

You could use .split("") on the input string to split it into an array of strings where each element in the array was a word in your original string. In other words"ADD C She".split("") = {"ADD", "C",...

View Article


Flexible switch case syntax

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...

View Article
Browsing all 3 articles
Browse latest View live


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