how can i use a string in a switch statement?
Mayank23
0
Light Poster
Recommended Answers
Jump to Posthow can i use a string in a switch statement?
You can't. You can only switch on "integral types" like char and int.
You need to do a bunch of if-else if statements for strings.
All 4 Replies
VernonDozier
2,218
Posting Expert
Featured Poster
Mayank23
0
Light Poster
arkoenig
340
Practically a Master Poster
Fbody
682
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.