marksquall
Active member
- Joined
- Oct 17, 2009
- Messages
- 28
- Programming Experience
- 3-5
Dear vbdotnetforums.com administrators and members,
A greeting of peace. I hope everyone is in good health upon reading this forum.
I am just a little shocked with this VB .NET console application I just wrote:
My question is that why VB .NET "accepted" line 5? According to MSDN , the ReadLine() method returns a String. Is there any information I could read why VB .NET allowed this? I get used to Java that you need to parse String to a certian data type. But on my program, it seems like an autocasting to me.
I hope to hear from you guys who might know why this is allowed. Thank you very much.
Warm regards,
MarkSquall
A greeting of peace. I hope everyone is in good health upon reading this forum.
I am just a little shocked with this VB .NET console application I just wrote:
VB.NET:
Module MyModule
Sub Main()
Dim num As Integer
Dim square As Integer
Console.Write("Please enter your grade: ")
num = Console.ReadLine()
square = num * num
Console.WriteLine("The square of " & num & " is " & square)
End Sub
End Module
My question is that why VB .NET "accepted" line 5? According to MSDN , the ReadLine() method returns a String. Is there any information I could read why VB .NET allowed this? I get used to Java that you need to parse String to a certian data type. But on my program, it seems like an autocasting to me.
I hope to hear from you guys who might know why this is allowed. Thank you very much.
Warm regards,
MarkSquall
Last edited: