Issue with parsing multiple items with "="

There seems to be issue with the parsing of complex expressions with multiple items in the equal, the following code works
for K=2:NZ1
for J=2:NY1
for I=2:NX1
HXS[I,J,K],HYS[I,J,K],HZS[I,J,K]=
HXS[I,J,K]-sum(ygradkernel[0,-1:1,0].*EZS[I,J-1:J+1,K])*HCRLY2[IDONE[I,J,K]]+
sum(zgradkernel[0,0,-1:1].*EYS[I,J,K-1:K+1])*HCRLZ2[IDONE[I,J,K]],
HYS[I,J,K]-sum(zgradkernel[0,0,-1:1].*EXS[I,J,K-1:K+1])*HCRLZ2[IDTWO[I,J,K]]+
sum(xgradkernel[-1:1,0,0].*EZS[I-1:I+1,J,K])*HCRLX2[IDTWO[I,J,K]],
HZS[I,J,K]-sum(xgradkernel[-1:1,0,0].*EYS[I-1:I+1,J,K])*HCRLX2[IDTHRE[I,J,K]]+
sum(ygradkernel[0,-1:1,0].*EXS[I,J-1:J+1,K])*HCRLY2[IDTHRE[I,J,K]]
end
end
end

The following code does not work (only change in position of +)
for K=2:NZ1
for J=2:NY1
for I=2:NX1
HXS[I,J,K],HYS[I,J,K],HZS[I,J,K]=
HXS[I,J,K]-sum(ygradkernel[0,-1:1,0].*EZS[I,J-1:J+1,K])*HCRLY2[IDONE[I,J,K]]+
sum(zgradkernel[0,0,-1:1].*EYS[I,J,K-1:K+1])*HCRLZ2[IDONE[I,J,K]],
HYS[I,J,K]-sum(zgradkernel[0,0,-1:1].*EXS[I,J,K-1:K+1])*HCRLZ2[IDTWO[I,J,K]]
+sum(xgradkernel[-1:1,0,0].*EZS[I-1:I+1,J,K])*HCRLX2[IDTWO[I,J,K]],
HZS[I,J,K]-sum(xgradkernel[-1:1,0,0].*EYS[I-1:I+1,J,K])*HCRLX2[IDTHRE[I,J,K]]
sum(ygradkernel[0,-1:1,0].*EXS[I,J-1:J+1,K])*HCRLY2[IDTHRE[I,J,K]]
end
end
end

Please put you code in code blocks using ``` above and below the code, then we can read it :slight_smile:

It also helps if it’s indented - 4 spaces is the standard.

But it looks like you have moved the + to the start of a new line - and that just doesn’t work in Julia syntax. You need to leave it at the end of the previous line to indicate that the line continues.

3 Likes

Thank you good to know.

1 Like