【发布时间】:2019-10-09 11:13:10
【问题描述】:
为了简化我的代码,我制作了一个包含“if”语句的函数。该函数旨在在另一个函数的“For”循环中调用。我想在稍后调用的自定义函数中放置一个“继续”语句。有没有可能做到这一点而不会出错?代码是用 Google Apps 脚本编写的。
function example1() {
//code here
continue;
}
}
function example2() {
for(var x = 1 ; x <= 2 ; x++) {
example1();
}
}
在 example1() 函数中调用“continue”语句时出现错误,因为“continue”语句不在“For”循环中。但是 example1() 函数仅创建为在 example2() 'For' 循环语句中调用。
【问题讨论】:
-
在 Google Apps 脚本中的“自定义函数”通常是指 Google 表格用户定义的函数。参考。 developers.google.com/apps-script/guides/sheets/functions
标签: javascript for-loop google-apps-script