Powerful PowerPoint for Educators: Using Visual Basic for Applications to Make PowerPoint Interactive


Download 1.37 Mb.
Pdf ko'rish
bet50/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   46   47   48   49   50   51   52   53   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

userName
).
done
is de clared as
Boolean
be cause
Boolean
variables can be 
True
or
False
, and we are ei ther
done or we are not done.
We start by setting the value of 
done
to
False
(be cause the stu dent surely
has not typed a name before we even have asked). Next, we use a 
While
loop
(see Chapter 8 for more about
While
loops). This is a method of do ing some-
thing over and over again as long as we want to keep go ing. We know we want to 
keep go ing if whatever co mes af ter the word
While
is 
True
.
Not False
is the
same thing as
True
, so if 
done
is 
False
,
Not done
is 
True
, and we keep go -
ing. In Eng lish, we keep go ing as long as we are not done.
How do we know when we are done? That is where the
If
state ment co mes 
in. We check to see what the student has typed (as stored in 
userName
) and
compare that to 
""
(that is two dou ble quotes with noth ing be tween them, also
known as the empty string or nothing). If the student typed noth 
ing (
If
username = "" Then
) then we are not done, so we set
done
to
False
(
done
= False
); that is, we put the value 
False
in the vari able named
done
. Oth er-
wise (
Else
) the student must have typed something, so we are done, and we set
56 Let’s Get Scripting


done
to 

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   46   47   48   49   50   51   52   53   ...   191




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling