Changing states on the change of a counter variable
I have kept a counter on the click of a title. I'm trying to change the state of the title when the counter variable contains an even number. I have created a variable named "counter" whose default value is 0 and this works till the counter variable increments to 2.
But it should be in the following way;
Counter = 1(odd), no change in the state
Counter = 2(even), change in the state
Counter = 3(odd), no change in the state
Counter =4(even), change in the state and so on
Could someone please suggest me a way to do this?