Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/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 用于填充维度变量的隐式循环_Loops_Fortran_Dimension - Fatal编程技术网

Loops 用于填充维度变量的隐式循环

Loops 用于填充维度变量的隐式循环,loops,fortran,dimension,Loops,Fortran,Dimension,我需要帮助来理解为什么我不能编译这段代码 program test integer,dimension(1:10) :: isquares isquares(:) = (j**2,j=1,10) print*,isquares end 但是,此版本还可以: program test print*,(j**2,j=1,10) end (j**2,j=1,10)是一个隐式循环。对于赋值,您需要首先将其转换为数组: isquares(:) = [(j**2,j=1,10)] 是的,但此功

我需要帮助来理解为什么我不能编译这段代码

program test
 integer,dimension(1:10) :: isquares
 isquares(:) = (j**2,j=1,10)
 print*,isquares
end
但是,此版本还可以:

program test
 print*,(j**2,j=1,10)
end
(j**2,j=1,10)
是一个隐式循环。对于赋值,您需要首先将其转换为数组:

isquares(:) = [(j**2,j=1,10)]

是的,但此功能仅在Fortran 2003版本中可用。jsquares(:)=[(j**2,j=1,10)]1错误:Fortran 2003:[…]在(1)处设置数组构造函数的样式,然后使用
(/(j**2,j=1,10)/)