Implement while
This commit is contained in:
parent
82cfdf567e
commit
7e6970b9e4
@ -1214,6 +1214,11 @@ function Library (client) {
|
||||
this.not = (a) => {
|
||||
return !a
|
||||
}
|
||||
this.while = (fn, action) => {
|
||||
while (fn()) {
|
||||
action()
|
||||
}
|
||||
}
|
||||
this.each = (arr, fn) => { // Run a function for each element in a list.
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const arg = arr[i]
|
||||
|
@ -421,6 +421,12 @@ function Library (client) {
|
||||
|
||||
// Arrays
|
||||
|
||||
this.while = (fn, action) => {
|
||||
while (fn()) {
|
||||
action()
|
||||
}
|
||||
}
|
||||
|
||||
this.each = (arr, fn) => { // Run a function for each element in a list.
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const arg = arr[i]
|
||||
|
Loading…
x
Reference in New Issue
Block a user