Android Question SOLVED: Two instructions in one line?

Gaxapu

Member
Licensed User
Hello forum members

Is there a way to put two or more instructions in one line?
Example:
Write this code
Example1:
Sub Prueba as Boolean
return False
end sub
as
Example2:
Sub Prueba as Boolean; return False; end sub
Change the ";" for whatever is needed.

Thanks
 
Last edited:

Gaxapu

Member
Licensed User
Th
Moved to the questions forum. You can use colon to add another statement on the same line.
However it will not work on the Sub line.

I also don't recommend using it too much.
Thanks Erel.
Not sure in which forum should I put the question. My best bet was the general one. Never thought it should be in Android.

I was almost sure I saw the colon used for the purpose but it wasn´t working in the example.
Just out of curiosity: Why it does not work in the Sub line?

I don´t use it too much. I was only trying to beatufy a large, repetitive chunk of code.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not sure in which forum should I put the question. My best bet was the general one.
You've posted it in the "forum discussion". This is the place for discussions related to the forum itself. General B4X related questions should go to anyone of the three questions forums. You can add [B4X] to the thread title to mark it as a cross platform thread.

Just out of curiosity: Why it does not work in the Sub line?
The parser needs to build the document main structure very quickly as it happens while the developer types. It assumes that subs are declared in their own line.

I was only trying to beatufy a large, repetitive chunk of code.
Post the relevant code. I have a feeling that there are better ways to solve it.
 
Upvote 0

Gaxapu

Member
Licensed User
Wow, you are very fast responding.

Post the relevant code. I have a feeling that there are better ways to solve it.

The code is a bunch of Gettters and Setters of properties of a CustomView.
I can post the code if you want. It´s just faster to explain.

Example:
Public Sub getModo1Color As Int
    Return mModo1.Color
End Sub
Public Sub setModo1Color(Value As Int)
    mModo1.Color = Value
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…