Just like the clothes you wear, the code you write will also reflect your personal style.
Let's get fancy, shall we?
Do you have some more fancy examples of elegant B4X code?
Share it with us!
Let's get fancy, shall we?
B4X:
'Ugly:
Dim validation As Boolean
Dim sum = 1 + 1 As Int
If sum = 2 Then validation = True
'Elegant:
Dim sum = 1 + 1 As Int
Dim validation = (sum = 2) As Boolean
B4X:
'Ugly:
a = a + 1
If a >= 100 then a = 100
'Elegant:
a = min(a + 1, 100)
B4X:
'Ugly:
a = a - 1
If a <= 0 then a = 0
'Elegant:
a = max(a - 1, 0)
Do you have some more fancy examples of elegant B4X code?
Share it with us!
