B4J Question Is it possible to split a line of code?

ranul

Member
Licensed User
Longtime User
Hi,

If I have a long line of code, like that:

B4X:
dim sts as int

sts = MyFunction("text1", "text2", "text3", "text4", "text5", "text6")

Is there a way to split the line like that:

B4X:
dim sts as int

sts = MyFunction("text1",
                "text2",
                "text3",
                "text4",
                "text5",
                "text6")

Thanks
 
Solution


B4X:
sts = MyFunction("text1", _
    "text2", _
    "text3", _
    "text4", _
    "text5", _
    "text6")

behnam_tr

Active Member
Licensed User
Longtime User


B4X:
sts = MyFunction("text1", _
    "text2", _
    "text3", _
    "text4", _
    "text5", _
    "text6")
 
Upvote 2
Solution

emexes

Expert
Licensed User
Is there a way to split the line

A longer example is the TestData at:

 
Upvote 0

emexes

Expert
Licensed User
B4X:
dim sts as int

sts = MyFunction("text1",
                 "text2",
                 "text3",
                 "text4",
                 "text5",
                 "text6")

On a related note: another way to pass lots of parameters, is as an array.
Has the advantage of enabling variable number of parameters, eg sometimes 12, othertimes 6, eg:

B4X:
Dim sts12 As Int = MyFunction( Array As String("text1", "text2", "text3", "text4", "text5", "text6", "text7", "text8", "text9", "text10", "text11", "text12") )
Dim sts6 As Int = MyFunction( Array As String("texti", "textii", "textiii", "textiv", "textv", "textvi") )

which you can also split across lines eg:

B4X:
Dim sts7 AS Int = MyFunction( Array As String( _
    "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", _
    "Saturday", "Sunday" _
) )
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…