以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 数值循环 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=142609) |
-- 作者:良才 -- 发布时间:2019/11/1 10:40:00 -- 数值循环 Dim Day,Js As Integer Day = e.Sender.Value If Day > 0 Then If Day >= 10 And Day < 20 Then Js = 1 Else If Day >= 20 And Day < 30 Then Js = 3 Else If Day >= 30 And Day < 40 Then Js = 5 Else If Day >= 40 And Day < 50 Then Js = 7 Else If Day >= 50 And Day < 60 Then Js = 9 Else If Day >= 60 And Day < 70 Then Js = 11 Else If Day >= 70 And Day < 80 Then Js = 13 Else If Day >= 80 And Day < 90 Then Js = 15 Else If Day >= 90 And Day < 100 Then Js = 17 Else If Day >= 100 And Day < 110 Then Js = 19 End If End If 怎样用循环简化,请指教,谢谢!
|
-- 作者:有点蓝 -- 发布时间:2019/11/1 10:53:00 -- Dim Day As Integer = 50 For i As Integer = 1 To 10 If day >= i *10 And day < (i+1) * 10 msgbox(i*2 - 1) Exit For End If Next
|
-- 作者:良才 -- 发布时间:2019/11/1 11:06:00 -- 谢谢 |
-- 作者:有点蓝 -- 发布时间:2019/11/1 11:13:00 -- 如果规律不变的话,这样更简单一点 Dim Day As Integer = 19 msgbox(math.Floor(Day / 10) * 2 - 1) |
-- 作者:dzy1232016 -- 发布时间:2019/11/1 11:39:00 -- 经典 |