Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 丢失的在for循环初始值设定项之后。。。再一次_Loops_For Loop_Syntax - Fatal编程技术网

Loops 丢失的在for循环初始值设定项之后。。。再一次

Loops 丢失的在for循环初始值设定项之后。。。再一次,loops,for-loop,syntax,Loops,For Loop,Syntax,错误:丢失;在for循环初始值设定项之后。(第3行,文件“Tst”) 这是代码的复制/粘贴: function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); for (int i = 0; i < ss.getNumberOfSheets(); i++){ Sheet sheet = ss.getSheetAt(i); Logger.log(sheet.getName()); } }

错误:丢失;在for循环初始值设定项之后。(第3行,文件“Tst”)

这是代码的复制/粘贴:

function myFunction() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  for (int i = 0; i < ss.getNumberOfSheets(); i++){
    Sheet sheet = ss.getSheetAt(i);
    Logger.log(sheet.getName());
  }
}
函数myFunction(){
var ss=SpreadsheetApp.getActiveSpreadsheet();
对于(int i=0;i

我看不到任何缺少的分号???

如果用var替换int,甚至删除I的声明,该怎么办?看起来像JavaScript,是吗

function myFunction() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  for (i = 0; i < ss.getNumberOfSheets(); i++){
    Sheet sheet = ss.getSheetAt(i);
    Logger.log(sheet.getName());
  }
}
函数myFunction(){
var ss=SpreadsheetApp.getActiveSpreadsheet();
对于(i=0;i
这是哪种语言?假设这是Javascript,因为它显然不是Java,用
var
替换
int
。声明JS变量时不指定类型。请不要回答此类问题。如果你有问题,请发表评论。对不起,是的。这是Google sheets宏。@chuckt62你是说Javascript吗?那是一种与你完全不同的语言。JAVA