Visual Basic代码报错:第32行存在错误,请求问题排查
Fixing Your Line 32 Visual Basic Syntax Error
Hey there! That error on line 32 is a straightforward string concatenation issue—let's sort it out quickly.
The Broken Line (Original)
Console.WriteLine(outcomeDrink & " " & outcomeKG & " " & outcomeSenior " " &)
Two syntax issues here are tripping up the compiler:
- After
outcomeSenior, you forgot the&operator to connect the subsequent" "string. - There's an extra, dangling
&at the end of the line with no value to concatenate to it.
The Corrected Line
If you just want to join the three outcome strings with spaces between them, this will work perfectly:
Console.WriteLine(outcomeDrink & " " & outcomeKG & " " & outcomeSenior)
If you intended to add an extra space at the very end, you can adjust it to:
Console.WriteLine(outcomeDrink & " " & outcomeKG & " " & outcomeSenior & " ")
Quick Side Note (Not Related to the Error)
I noticed you're initializing your Boolean variables (isInKG, canDrink, etc.) to Nothing. While VB allows this, Boolean is a value type that defaults to False automatically—you can skip those initializations if you want to clean up your code a bit.
内容的提问来源于stack exchange,提问作者Poshak Pathak
相关产品推荐
相关产品推荐

