如果想在 case 中用这个值,那么可以用过值绑定 (value bindings) 解决: let somePoint = (0, 1)switch somePoint {case (0, 0):println("(0, 0) is at the origin")case (let x, 0):println("...
基于50个网页-相关网页
Value Binding Expressions 值绑定表达式
Value-Binding Pattern 值绑定模式 ; 标识符
value-binding expression 值绑定表达式
Parameter, target, exception and return value binding.
参数,目标,异常以及返回值绑定。
The only difference from Listing 5 is the value binding expression.
与清单5惟一的不同之处在于值绑定表达式。
Next, you create a value binding to get the type that is being bound to a particular component.
下一节,您将创建值绑定,以获得绑定到特殊组件的类型。
Right, because when we think of an energy diagram, that lowest spot there is going to have the lowest value of the binding energy or the most negative value of binding.
对因为当我们考虑,一个能量图时那里最低的点,是具有最低的结合能,或者最不活跃的结合能。
x It says, take the name x and create a binding for that name to the value of the sub-expression and in fact to do this, to stress a point, let's do that.
它的意思是,创建了一个名字,然后创建了对于这个名字,和子表达式的值的绑定,实际上这么做,我们是为了,要强调一个点,让我们来说说这个点。
I don't have to go read what it printed out in the screen. This has returned a value that I can use. Because I could do a test to say, is this a return value? If it's not, I'll do something else with it. So the binding is still there, it simply doesn't print it out.
我不想读到屏幕中打印出来的这行字,程序返回过一个我能够使用的值,因为我可以做个小测试,来说明这是否是返回的值,如果不是,我可以做一些其它的事,而这个绑定依然在这儿,没有打印任何东西。
应用推荐