VB.NET 2013: Parameters - ByRef vs ByVal, Optional and Arrays

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 16

  • @whitelion6912
    @whitelion6912 7 років тому +3

    Thanks mate you are helping me getting my A level in computer science. Thanks for the tutorials with OOP as well

  • @rajtechking
    @rajtechking 4 роки тому

    Your channel is really underrated.

  • @1480551
    @1480551 9 років тому

    Good Job man, your teaching skills really show in your ability to provide good lessons for understanding this stuff. Your vids are Awesome!

  • @mohammaddiaah.5513
    @mohammaddiaah.5513 5 років тому

    Amazingly informative and endearing, thank you for the video!

  • @wezil68s
    @wezil68s 7 років тому

    Fantastic tutorial, thanks!

  • @daniellugo4272
    @daniellugo4272 9 років тому +1

    Very cool explained...

  • @examinestudios2410
    @examinestudios2410 8 років тому

    thank's for that nick, and I do intend to keep programming!

  • @michaelfraker6302
    @michaelfraker6302 9 років тому +1

    Two things:
    1. When I hit the return key to avoid entering a third number, it throws an error because a put "" string in the single variable.
    2. In cases where there are multiple optional parameters, how do you pass say the 2nd optional parameter. How do you let the function or sub know that it wasn't intended for the first optional parameter?
    Thanks for the videos Nicholas. Love them.

    • @NicholasDingle
      @NicholasDingle  9 років тому

      +michael fraker
      1) To avoid this type of error, accept the ReadLine input into a String, instead of an Integer/Float. Then try to convert the String variable to an Integer, such as:
      Dim num3 As Integer
      Dim input3 As String = Console.ReadLine()
      If IsNumeric(input3) Then
      num3 = CInt(input3)
      End If
      2) If you want to skip the first optional parameter you leave it blank, insert your comma and then insert the value for the second parameter. For example:
      AddNums(, 5)

  • @examinestudios2410
    @examinestudios2410 8 років тому +1

    Nicholas, I have gotten a little confused. Ok so in the part where we use arrays and we have a for loop why do we - 1 it kinda doesn't make sense to me?

    • @NicholasDingle
      @NicholasDingle  8 років тому +1

      Great question as you'll be seeing the -1 lots and lots if you keep programming.
      Here's an example for you, if I have an Array with 10 items then they aren't numbered 1, 2, 3, 4... 10; they are numbered 0, 1, 2... 9.
      So in my For loop I repeat from 0 to Array.Length -1, which would look like For i = 0 to 10 - 1 THUS becoming For i = 0 to 9.
      I hope that helps.

  • @HaiderAli-pp9go
    @HaiderAli-pp9go 8 років тому

    how is the function returning 2 values? total and avg. i dont get that

  • @ropgem2628
    @ropgem2628 5 років тому

    nice

  • @haydarm.al-samawe9819
    @haydarm.al-samawe9819 8 років тому

    you use in num3 optional -1 as not include value so what if the user try to chose this value in his calculation of example i need average for( 5, 7, -1)? bad luck can happen ))

    • @NicholasDingle
      @NicholasDingle  8 років тому

      +haydar M.Al-samawe Yeah pretty much would be bad luck in this case. I use this for tutorials because it's much easier to understand. However, in my own programs I'd probably look at a nullable primative instead of the -1 value.