aardio 有没有VB 的类似如下选择判断函数?

mndsoft 2月前 301

请问aardio 有没有VB 的类似如下选择判断函数,谢谢


Switch 函数示例
本示例使用 Switch 函数返回和城市名称匹配的语言名称。

Function MatchUp (CityName As String)
   Matchup = Switch(CityName = "London", "English", CityName _
               = "Rome", "Italian", CityName = "Paris", "French")
End Function

IIf 函数示例
本示例使用 IIf 函数来判断 CheckIt 过程之 TestMe 参数的值,如果参数值大于 1000 则传回“Large”;否则传回“小图标”。

Function CheckIt (TestMe As Integer)
   CheckIt = IIf(TestMe > 1000, "Large", "Small")
End Function

Choose 函数示例
本示例使用 Choose 函数来显示一个名称,该名称对应於用 Ind 参数传递到过程之中的索引。

Function GetChoice(Ind As Integer)
   GetChoice = Choose(Ind, "Speedy", "United", "Federal")
End Function


最新回复 (3)
  • 光庆 2月前
    0 2
    import console; 
    
    function MatchUp(CityName){
    	return ({"London"="English";"Rome"="Italian";"Paris"="French"})[[CityName]]; 
    }
    function MatchUp1 (CityName){
    	select(CityName) {
    		case "London" {
    			return "English"; 
    		}
    		case "Rome" {
    			return "Italian"; 
    		}
    		case "Paris" {
    			return "French"; 
    		}
    	}
    }
    
    function CheckIt(TestMe){
    	return TestMe>1000?"Large":"Small"; 
    }
    
    function GetChoice(Ind){
    	return ({"Speedy", "United", "Federal"})[[Ind]]; 
    }
    
    console.dump(MatchUp("Rome"))
    console.dump(MatchUp1("Paris"))
    
    console.dump(CheckIt(888))
    console.dump(CheckIt(8888))
    
    console.dump(GetChoice(1))
    console.dump(GetChoice(3))
    
    console.pause(true);

  • mndsoft 2月前
    0 3

    速度牛,感谢站长,受教了

  • breezee 2月前
    0 4
    两种语言对比着学习确实上手快。相比而言,aardio确实更灵活些。
返回