vb中iif的目的是什么 [英] what is the purpose of the iif in vb

查看:38
本文介绍了vb中iif的目的是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那么,vb 中 iif 的目的是什么?我知道它的作用,但我不明白它的用途是什么?

So, what is the purpose of the iif in vb? I know what it does, but I can't uderstand what is it for?

更新:我知道它的作用.但是if(,,)"也是如此.唯一的区别是Iif"将对两个表达式求值.那么这样做的目的是什么?

Update: I know what it does. But "if(,,)" does the same. The only difference is that "Iif" will evaluate both expressions. So what is the purpose of doing this?

谢谢!

推荐答案

它允许生成一个值的简洁布尔逻辑表达式

It allows for a concise boolean logic expression which produces a value

Dim value = Iif(someTest, trueValue, falseValue)

如果没有 IifIf 运算符,这必须扩展为一组更繁琐的语句

Without the Iif or If operator this has to be expanded into a more combursome set of statements

Dim value;
If someTest Then
  value = trueValue
Else
  value = falseValue
End If

这篇关于vb中iif的目的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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