0

Is it possible for an if and else statement to exist inside a switch statement?

trying this code for my project.. still a beginner. https://code.sololearn.com/c4JmUSoq4ctd/?ref=app

10th Oct 2018, 2:29 PM
LadyNooob
LadyNooob - avatar
5 ответов
+ 5
Lady101 You are using only Code Playground to develop your project, am I right? If that is the case, then it's not a problem with the code, but rather an issue with Code Playground. Code Playground is an online IDE which needs to take all input before compiling the code. If you want to run the code and have it ask questions one by one so that the user can answer one at a time, you need to run it using desktop or other IDEs.
10th Oct 2018, 11:39 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
You've just demonstrated that it is perfectly possible.
10th Oct 2018, 2:34 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
this is just an example of what im going to do for a project
10th Oct 2018, 2:30 PM
LadyNooob
LadyNooob - avatar
+ 1
yes but im missing something though.. im trying to make a trivia quiz just using if else statement inside a switch statement .. for example , there are 3 choices of my trivia, example. 1.Life Science 2.Astronomy 3. Earth science. if you choose 1. life science (which is the case 1) inside there will be 10 questions about life science. And if u choose 2. Astronomy (which is going to be case 2) there will be 10 questions related to astronomy .. my problem is that the moment i choose case 1 (which is life science) those 10 questions run all at once (without giving me a chance to answer the 1st to 9th questions.).. im trying to separate them a bit for me to type the answer of each of those questions.. i hope u understand my point.. its a bit hard for me to explain, cause english is not my forte though. hehe
10th Oct 2018, 2:49 PM
LadyNooob
LadyNooob - avatar
+ 1
oky thanks!
10th Oct 2018, 11:57 PM
LadyNooob
LadyNooob - avatar