了解Select Case语句 [英] Understanding the Select Case Statement

查看:78
本文介绍了了解Select Case语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在那里,我想了解Select Case Statement和Select Case Statement。完全和我认为的方式是在真实情况下使用它,例如使用某个城市和邮政编码。假设用户进入某个城市并在文本框中弹出压缩代码。任何人都可以帮助我理解这个理解吗?


lee123

hi there i want to understand the "Select Case Statement" fully and the way i think i would is to use it in a real situation such as using a certain "City and Zipcodes" lets say a user enters in a certain City and have the zipcode pop in the textbox. can anyone help me with this understanding?

lee123

推荐答案

这是一个糟糕的例子,因为一个城市可以拥有很多很多邮政编码。一个更好的例子恰恰相反!用户输入Zipcode,正确的城市将填充文本框。这很好,因为它允许演示呈现案例的多种方式。

That''s a poor example, because a city can have many, many Zipcodes. A much better example would be just the opposite! The user enters a Zipcode and the correct city would populate the textbox. This is good because it allows the demonstration of a number of ways presenting the case.

展开 | 选择 | Wrap | 行号


这里'使用选择案例的另一种鲜为人知的方法。


在这种情况下,平均值来源于评级。如果 PointAverage 高于某个值,那么评级就是如此。


如果 PointAverage 是为了这个演示版本6.0,那么Case表达式将满足每个Case ,因为6.0大于0,1.5,2.5,3.5,4.5和5.5!那么将哪个值分配给控件评级


选择案例构造中,如果值满足多于一个< b>案例,第一个满足的案例是执行的案例!要利用这一点,您可以按降序顺序构建选择案例,即首先使用最高值。因此,在这种情况下,评级将被分配为 U


同样地, PointAverage 4.7,评级将被分配 E 因为案例是> 4.5 是4.7满足的第一个案例

Here''s another little known way to use Select Case.

In this case, an average is being derived at and Ratings assigned accordingly. If the PointAverage is above a certain value, the Rating is thus and so.

If the PointAverage was, for the sake of this demo, 6.0, then the Case expression would satisfy every Case, because 6.0 is greater than 0, 1.5, 2.5, 3.5, 4.5 and 5.5! So which value is assigned to the control Rating?

In the Select Case construct, if a value satisfies more than one Case, the first Case that is satisfied is the one that is executed! To take advantage of this, you construct your Select Case in descending order, i.e. with the highest value first. So in this case, Rating would be assigned "U."

Likewise, with a PointAverage of 4.7, Rating would be assigned "E" because Case Is > 4.5 is the first Case that 4.7 satisfies.

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


感谢missinglinq这将帮助我完成我的编程。


lee123
Thanks missinglinq this will help me out alot in my programming.

lee123


这篇关于了解Select Case语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆