True
(
done = True
). The
Wend
just says that we are at the end of our
While
loop. Ev erything be tween the
While
and
Wend
will be ex ecuted over
and over again un til we are done (in this case, un til the stu dent types something).
If the user types noth ing, the
If
statement will set done to
While_state_ment._The_While'>False
, and loop
back up to the
While
state ment. The
While
state ment will see that we are not
done, so we should keep go ing and execute the stuff between
While
and
Wend
again. If the user types something, the
If
state ment will set
done
to
True
and
loop back up to the
While
state ment. The
While
statement will see that we are
done and move to whatever is after the
Wend
(we could do something else after
the
Wend
, but we don’t in this ex ample).
Two things to note:
1.
Students will be forced to type something, but that something could
be any thing: a sin gle space, a dirty word, a pe riod, etc.
2.
Students will only be forced to type something if they click on the
but ton as so ci ated with this script.
In later chapters, you’ll learn how to check what was typed to make sure it
is OK, as well as how to force the student to click on the but ton (don’t worry; it
doesn’t in volve physical force or shock ther apy).
What Else? A Personal Response and a
Short-An swer Ques tion
Now that you have a ba sic script that re sponds to what the student typed, we
can extend it just a lit tle to give a more per sonal re sponse. Then with almost no
effort, we can change the script from ask ing for a name to asking for the an swer
to a short-answer question.
The first step is to add
Do'stlaringiz bilan baham: |