|
8 | 8 | \item \pythonil{exit()}\pythonIdx{exit} exits and terminates the \python\ interpreter.%
|
9 | 9 | \end{itemize}%
|
10 | 10 | %
|
11 |
| -Now, it would be very strange if the \pythonil{print} function could print \inQuotes{Hello World!}. |
| 11 | +Now, it would be very strange if the \pythonil{print} function could \emph{only} print \inQuotes{Hello World!}. |
12 | 12 | That would not make much sense.
|
13 | 13 | \pythonilIdx{print} expects one parameter.
|
14 |
| -This parameter cannot just be anything. |
15 |
| -It must be a text. |
| 14 | +This parameter should be a text\footnote{Or it needs to support a certain method so that it can be comverted to a text, but please let's ignore this for now.}. |
16 | 15 |
|
17 | 16 | The command \pythonilIdx{exit}, on the other hand, can either have no parameter or one parameter.
|
18 | 17 | If it receives one parameter, this parameter will be the \pgls{exitCode} of the program.
|
19 |
| -Here, \pythonil{0} indicates success. |
| 18 | +Here, \pythonil{0}~indicates success. |
20 | 19 | If no parameter is provided, this will be used as default value.
|
21 |
| -We need to invoke \pythonilIdx{exit} if we use the \python\ console in the \pgls{terminal} explicitly. |
22 |
| -If we just run a program, then after the last instruction of the program was executed, then the interpreter will also terminate with \pgls{exitCode}~0. |
23 |
| -Indeed, when we executed our first program in \cref{sec:ourFirstProgram}, we saw exactly that happen in \cref{fig:firstProgram10programResult}. |
24 |
| -Different from the parameter of \pythonil{print}, which must be some text, the parameter of \pythonil{exit} needs to be a number. |
25 | 20 |
|
26 | 21 | We realize:
|
27 | 22 | Distinguishing different types of data makes sense.
|
28 | 23 | Sometimes we need to do something with text.
|
29 | 24 | Sometimes we want to do something with numbers.
|
30 |
| -Somtimes, we want to just handle a decision which can be either \inQuotes{yes} or \inQuotes{no}. |
| 25 | +Sometimes, we want to just handle a decision which can be either \inQuotes{yes} or \inQuotes{no}. |
31 | 26 |
|
32 | 27 | Of course, for these different situations, different possible operations may be useful.
|
33 | 28 | For example, when we use numbers, we may want to divide or multiply them.
|
|
0 commit comments