简体   繁体   English

VS2013 vs VS2015单行如果…那么

[英]VS2013 vs VS2015 single line If…Then

The following statement compiles and works in VS2013, but does not in VS2015: 以下语句可在VS2013中编译并工作,但在VS2015中不行:

Dim z As Integer = 1
Dim y As Integer = 2

If z = 1 Then If y = 3 Then 

y = 4

The syntax appears to be incomplete, because of the trailing Then . 语法似乎是不完整的,因为尾随的Then I do not know why it would work in VS2013 and not in VS2015. 我不知道为什么它会在VS2013中工作而在VS2015中不工作。

After execution in VS2013, y = 4 , so the Then statement does not need to cascade to the next line. 在VS2013中执行后, y = 4 ,因此Then语句不需要级联到下一行。

Any thoughts as to why? 有什么想法吗? Is this a bug in VS2013? 这是VS2013中的错误吗?

Seems to be a 'bug or feature" that got dropped in VS2015... 似乎是在VS2015中删除的“错误或功能” ...

I suggest you use the more modern 我建议您使用更现代的

    If z = 1 AndAlso y = 3 Then y=4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM