Advertisement
cogier

Call a function

Apr 8th, 2020
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.63 KB | None | 0 0
  1. 'https://rosettacode.org/wiki/Call_a_function
  2. Imports System
  3. Module Program
  4.     Sub Main()
  5.  
  6.         Hello()
  7.         Console.WriteLine(CopyIt("Hello ", 6))
  8.         Console.WriteLine(CopyIt("Hello ", 3, "!!"))
  9.  
  10.     End Sub
  11.  
  12.     Public Function CopyIt(sString As String, siNo As Short, Optional sEnd As String = "") As String
  13.         Dim siCount As Short
  14.         Dim sNewString As String = ""
  15.  
  16.         For siCount = 1 To siNo
  17.             sNewString &= sString
  18.         Next
  19.  
  20.         Return Trim(sNewString) & sEnd
  21.  
  22.     End Function
  23.  
  24.     Public Sub Hello()
  25.  
  26.         Console.WriteLine("Hello world!")
  27.  
  28.     End Sub
  29. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement