Having an issue trying to figure out how to see if a value exisits in a table.
I am randomizing a test/quiz app and I'm pretty sure I'm on the right track here -
#1. create a temp table to store the used question numbers in
#2. generate a random number
#3a. IF that number is not in the table, THEN do some stuff and write that question number into the temp table - OR
#3b if that number is in the table GOTO #2
I just can't seem to figure out how to check to see if a table contains a value... or how to "GOTO #2"
Can someone point me to an example please?
Thanks guys!
I am randomizing a test/quiz app and I'm pretty sure I'm on the right track here -
#1. create a temp table to store the used question numbers in
#2. generate a random number
#3a. IF that number is not in the table, THEN do some stuff and write that question number into the temp table - OR
#3b if that number is in the table GOTO #2
I just can't seem to figure out how to check to see if a table contains a value... or how to "GOTO #2"
Code:
random_question = Math.Random(10); if (table.used_q does not contain random_question) then Paragraph.SetText("a_box", Question_Bank[random_question].A); Paragraph.SetText("q_box", Question_Bank[random_question].Q); table_row = table_row + 1; Table.Insert(used_q, table_row, random_question); else loop back to random_question generation end
Thanks guys!
Comment