开发者

How to add a score tracker in an if/else statement for a multiple choice game, and a few other things

开发者 https://www.devze.com 2023-01-30 07:17 出处:网络
//this is what I have so far.. just wondering where and how I\'d put the rest for the score tracker? I\'m going to be making 3 of these multiple choice questions, so what would be the best way I lay t

//this is what I have so far.. just wondering where and how I'd put the rest for the score tracker? I'm going to be making 3 of these multiple choice questions, so what would be the best way I lay that out and transition from one question to another? a开发者_JAVA技巧lso, I'm wondering what a boolean is and if that would help me for making an answer not case-sensitive. Thanks a lot!

btn.addEventListener("click",button);
function button(click) {
 var answer:String=input_txt.text;
 if (answer=="") {
  output_txt.text="Correct!";
 } else {
  output_txt.text="Incorrect";
 }
}


Have a variable called score, increment it a certain amount each time a correct answer is chosen.

A boolean is a variable that is either True or False. If you want make the text non case sensitive, you can use the stringName.toLowerCase() method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号