1 Replies - 1609 Views - Last Post: 26 February 2016 - 09:58 AM

#1 jamesm6147   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 31-May 15

else statement help

Posted 26 February 2016 - 05:19 AM

I am essentially creating a quiz in flash for matching somebody with a dog breed. I have used the if and else statements to generate different scenarios and a dog breed is generated from the answers that are given. This works fine but the problem I have is that there are not enough dog breeds that I am using to match up with all the possible outcomes that can be generated from the questions.

I want to make it so that if the answers that are chosen from the questions do not match the dog breed, it will then match up to a breed that is the closest match to the answers given. I have added a sample of the code to show how it works. any help would be greatly appreciated!

 if(q1answer == 3 && q2answer == 1 && q3answer == 2) {

	resultNo = 0;
} 
else if(q1answer == 1 && q2answer == 2 && q3answer == 1) {
	resultNo = 1;
}
else if(q1answer == 1 && q2answer == 3 && q3answer == 3) {
	resultNo = 2;
}
else if(q1answer == 1 && q2answer == 1 && q3answer == 2) {
	resultNo = 3;
} 


Is This A Good Question/Topic? 0
  • +

Replies To: else statement help

#2 ArtificialSoldier   User is online

  • D.I.C Lover
  • member icon

Reputation: 2365
  • View blog
  • Posts: 7,220
  • Joined: 15-January 14

Re: else statement help

Posted 26 February 2016 - 09:58 AM

I'm not sure what kind of help you're asking for.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1