⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 if_then.bas

📁 82 sample programs written in BASCOM-8051 for 8051 developement
💻 BAS
字号:
'--------------------------------------------------------------
'                     (c) 1997-2000 MCS Electronics
'--------------------------------------------------------------
'  file: IF_THEN.BAS
'  demo: IF, THEN, ELSE
'--------------------------------------------------------------
Dim A As Byte , B1 As Byte

Input "Number " , A                                           'ask for number
If A = 1 Then                                                 'test number
   Print "You guested it!"
End If

If A = 0 Then                                                 'test again
   Print "Wrong"                                              'thats wrong
Else                                                          'print this if a is not 0
   Print "Almost?"
End If

Rem You Can Nest If Then Statements Like This
B1 = 0
If A = 1 Then
  If B1 = 0 Then
     Print "B1=0"
  End If
Else
  Print "A is not 0"
End If

Input "Number " , A
If A = 1 Then                                                 '
  Print "Ok"
Elseif A = 2 Then                                             'use elseif for more tests
  Print "2" : A = 3
Elseif A = 3 Then
  Print "3"
End If

If A.1 = 1 Then Print "Bit 1 set"

End

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -