Logic Control
Codes:
Output:
Conclusion:
The for
in there, is like Python's while
. In other words, is just like if
, for example: if i <= 10: do things
.
Codes:
Conclusion:
This structure is picked up from C++. You can understand it in this way: for i == 1
, if i <= 10
, running following part of codes, then i = i + 1
. (for == 对于、基于)
We haven't finished yet. The most important control method is if
and else
.
if
and else
.It's definitely inherited from C++
, I can feel it.
C++
, I can feel it.I must say, compare to Python, you have to write more codes to reach the same goal.
Last updated