Page 1 of 1

quiz app - "if/case statement"

Posted: Tue Mar 10, 2015 10:48 pm
by Questionat0r

Hello,
I am trying to build a simple multiple choice quiz app.
I'm stuck at the part where i need the app to give feedback on whether the question was answered correctly directly after it has been answered.

I need an IF statement or something to accomplish this:
if clicked item = [correct_item(located in dabase)] then show "Correct" on the feedback page...

can anyone please point me in the right direction?

thanks!


quiz app - "if/case statement"

Posted: Tue Mar 10, 2015 11:25 pm
by Bruce Stuart

As a quick place to look ... Go to w3schoolscom

The syntax, and capitalization IS important is

If ( some logical expression)
{ some group of statements all separated by ; }
else { some group of statements }

A case statement is called a switch statement ... And it's rough syntax is :

switch ( on some value ) {

case value1:
statement 1;
Statement 2;
break;

case value2-n:
erc

Code: Select all

default: 

}

Look at the w3schools.com for examples and exact syntax

Best,
Bruce


quiz app - "if/case statement"

Posted: Sun Mar 15, 2015 8:55 am
by Questionat0r

thanks bruice