- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在用 VB 制作 Baa Baa Black Sheep,但在我的程序的最后一点停滞不前。我试图让程序说明用户是否为拥有包的人输入了正确的信息,但它似乎没有注册最后一部分。非常感谢任何帮助!
Module Module1
Sub Main()
Dim WoolAnswer As String = ""
Dim BagNumber As Integer = 0
Dim FirstBag As String = ""
Dim SecondBag As String = ""
Dim ThirdBag As String = ""
Console.WriteLine("Do you have any wool?")
WoolAnswer = Console.ReadLine
If WoolAnswer = "yes" Then
Console.WriteLine("How many bags do you have?")
BagNumber = Console.ReadLine
If BagNumber = 3 Then
Console.WriteLine("Who is the first bag for?")
FirstBag = Console.ReadLine()
Console.WriteLine("Who is the second bag for?")
SecondBag = Console.ReadLine
Console.WriteLine("Who is the third bag for?")
ThirdBag = Console.ReadLine
Else
Console.WriteLine("That is not the correct amount of bags.")
End If
Else
Console.WriteLine("You have no wool.")
End If
**If (FirstBag = "master" & SecondBag = "dame" & ThirdBag = "little girl") Then
Console.WriteLine("You really know your nursery rhymes!")
End If**
**This is the part that doesn't work**
Console.ReadLine()
End Sub
End Module
最佳答案
您应该使用 AndAlso
运算符来比较您的值。
如果 FirstBag = "master"AndAlso SecondBag = "dame"AndAlso ThirdBag = "little girl"Then
您可以使用普通的 And
运算符来完成,但 AndAlso
支持短路。
编辑:短路是一种编程结构,如果语句的较早部分使检查语句的其余部分毫无意义,它允许您跳过对多部分条件语句的部分的评估。
示例:如果 a == b
返回,a == b AndAlso c == d
将不会尝试计算 c == d
错误
关于vb.net - 努力使童谣条件发挥作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26240192/
我正在尝试为我的项目创建一些单元测试,经过大量挖掘之后,我发现了Effort,这个想法很棒,它模拟数据库而不是处理伪造的DBContext,顺便说一句,很难做到正确使用复杂的架构。 但是,我将用户的电
我正在尝试对某些响应 Entity Framework 数据库上下文的类进行单元测试。为了寻求帮助,我设法找到了一个名为 Effort 的库,它似乎有点旧,而且没有很好的文档记录,但它似乎可以工作,而
这两天,Auto-GPT 爆火 https://github.com/Torantulino/Auto-GPT 它是一款让最强语言模型GPT-4能够自主完成任务的模型,让整个AI圈疯
为什么会出现这个异常?这是错误吗? 我正在使用 EF 测试库 Effort 创建我的数据库的内存实例并遇到这个有趣的场景: 打开DbContext1 将项目添加到表(不保存) 关闭DbContext1
我是一名优秀的程序员,十分优秀!