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

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • The basics playlist covers the essential skills and knowledge you'll need to program in VB.NET. This video covers the following features:
    Reintroduction to Parameters
    ByVal vs ByRef
    Optional Parameters
    Passing an Array as a parameter
    Previous Parameter Video: • VB.NET 2013 - Subs, Fu...
    As always any comments or suggestions please drop a line!

Комментарии • 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 4 года назад

    Amazingly informative and endearing, thank you for the video!

  • @wezil68s
    @wezil68s 7 лет назад

    Fantastic tutorial, thanks!

  • @examinestudios2410
    @examinestudios2410 8 лет назад

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

  • @daniellugo4272
    @daniellugo4272 9 лет назад +1

    Very cool explained...

  • @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)

  • @HaiderAli-pp9go
    @HaiderAli-pp9go 8 лет назад

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

  • @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.

  • @ropgem2628
    @ropgem2628 5 лет назад

    nice

  • @haydarm.al-samawe9819
    @haydarm.al-samawe9819 7 лет назад

    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  7 лет назад

      +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.