how to make a if loop happen repeat once

Solutions on MaxInterview for how to make a if loop happen repeat once by the best coders in the world

showing results for - "how to make a if loop happen repeat once"
Lou
30 Sep 2016
1//this is a long example but it workes for me
2//it makes the "code" happen as soon as criteria1 is true then it starts a timer
3//until it can happen agen
4
5if ( criteria1 ) {
6      this.switch = true
7    } else {
8      this.switch = false
9    }
10    if (this.switch == false) {
11      this.counter = this.counter + 1
12      
13    }
14    if (this.counter > timer && this.switch == true) {
15      the code used (code)
16      this.C1 = 0
17      
18    }