Pages

Search This Blog

ByVal Calling


Module Module1
    Sub Main()
        Dim result As Integer
        Dim x, y As Integer
        Console.WriteLine("ByVal")
        Console.Write("Enter Original value1:")
        x = CInt(Console.ReadLine)
        Console.Write("Enter Original value2:")
        y = CInt(Console.ReadLine)
        Console.WriteLine()
        result = sum2values(x, y) 'calling the function with 2 parameters
        Console.WriteLine("Result=" & result)
        Console.WriteLine()
        Console.WriteLine("Now Values of x=" & x & " and y=" & y)
        Console.WriteLine()
        Console.WriteLine("x and y are Unchanged")
        Console.ReadLine()
    End Sub
    'defining a function with 2 parameters
    Function sum2values(ByVal x, ByVal y)
        'modifying values of x and y
        Console.Write("Enter New value1:")
        x = CInt(Console.ReadLine)
        Console.Write("Enter New value2:")
        y = CInt(Console.ReadLine)
        sum2values = x + y
    End Function

End Module

1 comment:

  1. The best casinos to play at the table poker
    When you are playing 인천광역 출장마사지 for a while, you should 김포 출장마사지 be aware that playing the table poker is 경주 출장안마 much easier than just playing on the real money 과천 출장샵 poker tables. 당진 출장샵 You can

    ReplyDelete