G Gaxapu Member Licensed User Jun 10, 2020 #1 Hello forum members Is there a way to put two or more instructions in one line? Example: Write this code Code: Copy Sub Prueba as Boolean return False end sub as Code: Copy Sub Prueba as Boolean; return False; end sub Change the ";" for whatever is needed. Thanks Last edited: Jun 10, 2020
Hello forum members Is there a way to put two or more instructions in one line? Example: Write this code Code: Copy Sub Prueba as Boolean return False end sub as Code: Copy Sub Prueba as Boolean; return False; end sub Change the ";" for whatever is needed. Thanks
Erel B4X founder Staff member Licensed User Longtime User Jun 10, 2020 #2 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. Upvote 0
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.
G Gaxapu Member Licensed User Jun 10, 2020 #3 Th Erel said: 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. Click to expand... 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
Th Erel said: 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. Click to expand... 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.
Erel B4X founder Staff member Licensed User Longtime User Jun 10, 2020 #4 Gaxapu said: Not sure in which forum should I put the question. My best bet was the general one. Click to expand... 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. Gaxapu said: Just out of curiosity: Why it does not work in the Sub line? Click to expand... 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. Gaxapu said: I was only trying to beatufy a large, repetitive chunk of code. Click to expand... Post the relevant code. I have a feeling that there are better ways to solve it. Upvote 0
Gaxapu said: Not sure in which forum should I put the question. My best bet was the general one. Click to expand... 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. Gaxapu said: Just out of curiosity: Why it does not work in the Sub line? Click to expand... 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. Gaxapu said: I was only trying to beatufy a large, repetitive chunk of code. Click to expand... Post the relevant code. I have a feeling that there are better ways to solve it.
G Gaxapu Member Licensed User Jun 10, 2020 #5 Wow, you are very fast responding. Erel said: Post the relevant code. I have a feeling that there are better ways to solve it. Click to expand... 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. Code: Copy Public Sub getModo1Color As Int Return mModo1.Color End Sub Public Sub setModo1Color(Value As Int) mModo1.Color = Value End Sub Upvote 0
Wow, you are very fast responding. Erel said: Post the relevant code. I have a feeling that there are better ways to solve it. Click to expand... 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. Code: Copy Public Sub getModo1Color As Int Return mModo1.Color End Sub Public Sub setModo1Color(Value As Int) mModo1.Color = Value End Sub
Erel B4X founder Staff member Licensed User Longtime User Jun 10, 2020 #6 If there is no other logic except of setting or getting the value then you can remove this code and use public fields. Later if you need to add some logic then it will be simple to change to properties. Upvote 0
If there is no other logic except of setting or getting the value then you can remove this code and use public fields. Later if you need to add some logic then it will be simple to change to properties.