My question is, how can I make the program do something if some variable is equal to any element in an array? Is there any other simpler way than just looping through the entire array?
For example: Suppose there is a variable, line = 0; and an array, characters = [1,2,3,4];
So, what I want to do is that, if the variable "line", changes to any of the four elements in the array "characters" (i.e. 1,2,3,4), then the program needs to do something specific.
(The array can be way bigger than that and the elements in the array might be created during the program not beforehand.)