课题:if语句
(南通紫琅中学 信息技术学科 编写)
教学目标:熟悉四种格式的if语句。
讲解与演示:
¨ 新建一个文件。每键入一段if语句,解释-运行,或者运行-解释。
|
Private Sub Form_Load() Label1.Caption=”Compare” Text1.Text = 1 Text2.Text = 2 Command1.Caption=”answer” End Sub Private Sub Command1_Click() a = Text1.Text b = Text2.Text Label1.Caption=a Label2.Caption=b If a > b Then Label3.Caption = ">" If a < b Then Label3.Caption = "<" If a = b Then Label3.Caption = "=" End Sub |
If … then … |
|
|
|
|
If … Then … … End if |
|
|
|
|
|
If … then …else … |
|
|
|
|
|
If … Then … … Else ... … End if |
¨ 关系符
|
> |
< |
= |
<> |
>= |
<= |
学生活动:
¨ 编写与示例基本相同的工程。