Home > OS >  Shell command
Shell command

Time:10-04

For ((I=1, j=1; i<=100; I++, j +=2))
Do
Let "sum01 +=I
"# as j values increase faster than I, so you have to in the process of testing j value is not more than 100
If [$j - lt 100]; Then
Let "sum02 +=j"
Fi
The done
Echo "sum01=$sum01"
Echo "sum02=$sum02"
# the results


Why in the for loop I <=100, without the operator value $if statement judgment conditions in $j <=100 with $
The two different value operator specific difference in where?

CodePudding user response:

((

Six words six words

CodePudding user response:

For it is to define the variable j value, certainly not $
The back is called variable j, with $

CodePudding user response:

refer to the second floor zhouchao6 response:
for the inside is to define the variable j value, certainly not $
The back is called variable j, with $

For it is not I=1 defines the variable j, i<100 should be also call I, let I to grade 0 value is less than 1

CodePudding user response:

refer to the second floor zhouchao6 response:
for the inside is to define the variable j value, certainly not $
The back is called variable j, with $

For it is not I=1 defines the variable j, i<100 should be also call I, let I value is less than 100

CodePudding user response:

Weixin_45046469
reference 4 floor response:
Quote: refer to the second floor zhouchao6 response:
for the inside is to define the variable j value, certainly not $
The back is called variable j, with $

For it is not I=1 defines the variable j, i<100 should be also call I, let I value is less than 100?



This is the use of the for loop, define the I of the initial value is 1; And i<=100; I++ said every cycle, I + 1, which is the first time cycle, I=1, the second cycle I=2,...
  • Related