Do I have it correct now ??
The program runs and operates as expected.
My concern is more to the proper nomenclature than function.

Regards,

Lewis Balentine

'--- --- (project archive attached to message) --- ---
Private Function TestFunction() As String[]
  Return ["abcdefghij", "1234567890", "ABCDEFGHIJ"]
End

Private Sub DoPrint(XXX As String[])
  Dim S As String
  For Each S In XXX
    Print S
  Next
  Print "------"
End

Public Sub Main()
  Dim XXX As New String[]
  ' NOTE:
  '   The empty set of parentheses is REQUIRED when
  '   sort is used as a function to return an array.
  '     array=array.sort()   will work
  '     array=array.sort     will not work
  DoPrint(TestFunction())
  DoPrint(TestFunction().sort())
  '
  XXX = TestFunction()
  DoPrint(XXX)
  DoPrint(XXX.Sort())
  '
  XXX = TestFunction().sort()
  DoPrint(XXX)
  '
  ' NOTE:
  '   The empty set of parentheses is NOT required when
  '   sort is used as a procedure call to simply sort
  '   array without returning anything.
  '     array.sort()   will work
  '     array.sort     will work
  XXX = TestFunction()
  XXX.Sort
  DoPrint(XXX)
  '
  ' array.reverse and array.pop work similarly.
  DoPrint(XXX.Reverse())
  XXX.Reverse
  DoPrint(XXX)
  XXX.Pop
  Print XXX.Pop()

  ' parentheses are not used for an array's properties
  Print "======"
  XXX = TestFunction()
Print "'array.dim' returns the number of dimensions in an array: " & XXX.dim Print "'array.length' returns the number of items in an array: " & XXX.length Print "'array.count' returns the number of items in an array: " & XXX.count Print "'array.max' returns the number of items in an array: " & XXX.max

  Quit
End

Attachment: ArrayExample-0.0.1.tar.gz
Description: application/gzip

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to