请帮助解决一些基本语法
我需要发表一个声明,检查数字的余数除以4.
这是逻辑:
if the remainder of SOMETHING when divided by 4 is 1 then do this
if the remainder of SOMETHING when divided by 4 is 2 then do this
etc etc
我可以用SELECT CASE ..MOD格式来获取吗
答案 0 :(得分:4)
我想是的,你可以这样做:
Dim rem As Integer = number MOD 4
Select Case rem
Case 0
'....'
Exit Select
Case -3, 1
'....'
Exit Select
Case -2, 2
'....'
Exit Select
Case -1, 3
'....'
Exit Select
End Select