Android Question is there a shortcut like ++ to add 1 to a same variable?

William Lancee

Well-Known Member
Licensed User
Longtime User
@JohnJ No cigar.:confused:

AddOne.jpg
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
You can create a sub and call it when needed, something like:

Private sub add1(value as double)
return value +1
end sub

then declaring your variable in globals, you can just call add1(myvariable).

This is pseudo-code, may need tweaking or even not work as expected!
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
come on,
Basic radicalism should not be in B4x, even less in this forum...

i++ and i += 4 or i += j is so elegant and productive,

It should have been implemented in B4x since a while

Patrick
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
come on,
Basic radicalism should not be in B4x, even less in this forum...

Patrick
And you are addressing who?
I don't see anyone being "Basic Radical" in this thread, never saw it in the forum either...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
There are people who use VB.NET and say VB6 is outdated. But there are people still prefer to VB6.
There are people prefer JavaScript and say Java is too verbose.
There are people only see shining new front-end framework like React but jQuery actually works very well without require Node or NPM.
It is hard to please everyone.
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
i+=4?

To be frankly I don't mind to have ++, just because sometimes I port code from other languages to B4X and there are many "++/+="s, but I managed to convert it to i = i +.
You are right, with this heatwave in France, I didn't have very clear eyes this morning, i += 4 of course, corrected
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
come on,
Basic radicalism should not be in B4x, even less in this forum...

i++ and i += 4 or i += j is so elegant and productive,

It should have been implemented in B4x since a while

Patrick
Disagree. I am a Basic programmer/ I have been programing for 30+ years/ I don't know what i++ and i += 4 or i += j means. I learn a lot here but struggle with all there is to learn. When looking for code that can help me the last thing I need is new commands from other languages.

And I do not find these things elegant and productive. I see them as obscure and non-intuitive.
 
Upvote 0

emexes

Expert
Licensed User
new commands from other languages

PowerBASIC has INCR and DECR commands which are nice except for making the code less portable to other dialects of BASIC.

Also a heap of (reasonably) intuitive extensions like:

ASC(X$) returns first character value of X$, ASC(X$, 4) returns 4th character value of X$
CHR$(13, 10) returns CHR$(13) + CHR$(10)
Trim$(X$) removes leading and trailing spaces, Trim$(X$, ANY CHR$(13, 10, 32, 9)) removes leading and trailing CR, LF, spaces and tabs
 
Upvote 0
Top