case.bas

来自「82 sample programs written in BASCOM-805」· BAS 代码 · 共 22 行

BAS
22
字号
'-----------------------------------------------------
'                (c) 1998-2000 MCS Electronics
'  CASE.BAS demonstrates SELECT CASE statement
'-----------------------------------------------------
Dim I As Byte                                                 'dim variable
Dim S As String * 5 , Z As String * 5
Do
  Input "Enter value (0-255) " , I
  Select Case I
    Case 1 : Print "1"
    Case 2 : Print "2"
    Case 10 To 20 : Print "10-20"
    Case Is >= 30 : Print ">= 30"
    Case Else : Print "Not in Case statement"
  End Select
Loop
End

'note that a Boolean expression like > 3 must be preceded
'by the IS keyword
'also note that now only one expression can be tested in one CASE
'so CASE 1,2,3  or CASE 1 TO 3 is not supported now

⌨️ 快捷键说明

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