if i understood well i did this

declare Function as

PRIVATE FUNCTION anag(iStart AS Integer, iLen AS Integer, sArray AS
String[]) 'vars are ByVal by default

and from

PUBLIC SUB Button1_Click()
...
 anag(0, iLen, sArray.Copy)            'Make anagrams
....
END

but i get error "Type mismatch, wanted String[], get Function instead"

how to copy array?


2010/1/21 Benoît Minisini <gam...@users.sourceforge.net>

> > i found that
> >
> > Also, the contents of object
> > <http://gambasdoc.org/help/def/object?view>datatypes (array types,
> > collections, objects) are always passed by reference
> > in both languages!
> > from http://gambasdoc.org/help/doc/diffvb?view
> >
> > i think this is the problem!
> >
> > How to pass an Array byval in a function?
> >
> > i want to write something like that
> >
> > Private Function anag(ByVal iStart As Integer, ByVal iLen As Integer,
> ByVal
> > sArray As Variant)  'VB5
> >
> > PRIVATE FUNCTION anag(iStart AS Integer, iLen AS Integer, sArray AS
> Array)
> > 'Gambas
> >
> > ?
> >
>
> Objects are always passed by reference, as what is passed by value is the
> reference.
>
> You must declare your array argument as a String[], and use the Copy()
> method
> before sending the array recursively.
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 

Γεια χαρα σε όλους!!!

Regards,

Demosthenes Koptsis
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to