Do while loops with arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Do while loops with arrays

So I’m trying to make a do while loop that will loop until the user enters the right number that is in an array ,pls help

20th Oct 2019, 3:37 AM
Jonray
4 Answers
+ 2
You can do this: Do: n = input() If n is in array, break out of loop While (True)
20th Oct 2019, 3:39 AM
Tejaswi Hegde
Tejaswi Hegde - avatar
+ 2
That, or do: n = input() while n is not in array
20th Oct 2019, 3:51 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Jonray, what programming language you are talking about?
20th Oct 2019, 10:48 AM
Lothar
Lothar - avatar
+ 1
c language Lothar
20th Oct 2019, 12:17 PM
Jonray