Checking user answer in a quiz
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 1
- Joined: Wed Apr 03, 2024 4:05 am
- Contact:
Checking user answer in a quiz
Hi everyone,
I'm working on a quiz application in LiveCode. I can display the questions and allow users to select answers, but I'm having trouble checking if the chosen answer is correct and displaying feedback accordingly.
I've tried using conditional statements (if/else) but I'm not sure how to access the selected answer and compare it to the correct answer.
Can anyone point me in the right direction?
I'm working on a quiz application in LiveCode. I can display the questions and allow users to select answers, but I'm having trouble checking if the chosen answer is correct and displaying feedback accordingly.
I've tried using conditional statements (if/else) but I'm not sure how to access the selected answer and compare it to the correct answer.
Can anyone point me in the right direction?
Re: Checking user answer in a quiz
Hi.
So if you ask a certain question, do I assume that there is an answer already loaded somewhere? In other words, if you have a button with:
That sort of thing?
Craig
So if you ask a certain question, do I assume that there is an answer already loaded somewhere? In other words, if you have a button with:
Code: Select all
on mouseUp
answer "What is 2 + 2?" with "3" or "4" or "5"
if it = "4" then answer "RIGHT!" else answer "Wrong"
end mouseUp
Craig
Last edited by dunbarx on Wed Apr 03, 2024 2:41 pm, edited 2 times in total.
Re: Checking user answer in a quiz
Much depends on how your program interacts with the user. If you pose a question, like "What is 2 + 2", how do you want the user to respond? To enter a value in a field? To click on a line in a list? To click on one button of many?
What went wrong with your own code?
Craig
What went wrong with your own code?
Craig
Re: Checking user answer in a quiz
Rereading, maybe your real issue is:
Craig
Is that so?"How do I store the answer to the current question so I can compare it to whatever and however the user responds"
Craig
Re: Checking user answer in a quiz
I am assuming I am correct. Try out this test stack.
Craig
Craig
Re: Checking user answer in a quiz
The reality is that the OP's question is too vague to answer.
What kind of questions are asked? how is the information structured/stored.
There are a large number of ways to tackle this - but without knowing more people will just be guessing...
Asking the right question in the right way is half the road to enlightenment![Wink ;)](./images/smilies/icon_wink.gif)
What kind of questions are asked? how is the information structured/stored.
There are a large number of ways to tackle this - but without knowing more people will just be guessing...
Asking the right question in the right way is half the road to enlightenment
![Wink ;)](./images/smilies/icon_wink.gif)