Android Question Create sub with default params

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
is it possibile to create a sub like this:
B4X:
Public Sub Query (aSql As String, aLog As Boolean = False)
End Sub
and call:
B4X:
Query("SELECT * FROM ART")
where the parameter "aLog" is false by default, and only if I want to set true, I need to call it:
B4X:
Query("SELECT * FROM ART", True)
 

eurojam

Well-Known Member
Licensed User
Longtime User
you can pass an array oject, something like
B4X:
Query(Array As Object("SELECT * FROM ART", TRUE))
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
I don't like these solutions, because they complicate and lengthen the code. I need the 'OptionalParameter' to avoid writing useless code.
Are there any other solutions?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…