SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
if. . . else
if
test expression:
Body of
if
else
:
Body of
else
The
if..else
statement evaluates
test expression
and will execute the body of
if
only when the test condition is
True
.
If the condition is
False
, the body of
else
is executed. Indentation is used to separate the blocks.
if. . . else Statement Flowchart
Example
num
= -
8
if
num
>
0
:
(num,
"is a positive number."
)
else
:
(num,
"is a negative number."
)
>>> %Run -c $EDITOR_CONTENT
-8 is a negative number.
114
Chapter 3. For MicroPython User
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...