Other B4A v11.0 BETA is available for download

Erel

Administrator
Staff member
Licensed User
This update brings two new language features, recently added to B4J and B4i: IIf and As.

More information: https://www.b4x.com/android/forum/threads/b4j-v9-10-beta-is-available-for-download.132170/#content

B4X:
Label1.Text = IIf(EditText1.Text <> "", EditText1.Text, "Please enter value")

Dim Buttons As List = Array(Button1, Button2, Button3, Button4, Button5)
Dim s As String = Buttons.Get(2).As(B4XView).Text
Buttons.Get(2).As(B4XView).Text = "abc"
Dim j As String = $"{
data: {
key1: value1,
complex_key2: {key: value2}
},
items: [0, 1, 2]
}"$

Dim parser As JSONParser
parser.Initialize(j)
Dim m As Map = parser.NextObject
Dim value1 As String = m.Get("data").As(Map).Get("key1")
Dim value2 As String = m.Get("data").As(Map).Get("complex_key2").As(Map).Get("key")

Download link: https://www.b4x.com/android/files/beta.exe
 

divinglog

Member
Licensed User
Great features, this makes developing a lot more efficient! I coded my own IIf helper function, which I can now remove :)
Looks like "As" is like CType or Cast in VB.NET, which is great! Any chance that typed lists (List(of...) are comming in the future? But this is not really necessary anymore now with "As".
 
Upvote 0

AnandGupta

Well-Known Member
Licensed User
Thanks Erel,

I have been using iif(cond,true,false) statement in Clipper/Xbase from beginning so I am more at home now.
That's why I made wish for var++ like command as I also use them regularly in my job.
 
Upvote 0

ddefrain

Member
This update brings two new language features, recently added to B4J and B4i: IIf and As.

More information: https://www.b4x.com/android/forum/threads/b4j-v9-10-beta-is-available-for-download.132170/#content

B4X:
Label1.Text = IIf(EditText1.Text <> "", EditText1.Text, "Please enter value")

Dim Buttons As List = Array(Button1, Button2, Button3, Button4, Button5)
Dim s As String = Buttons.Get(2).As(B4XView).Text
Buttons.Get(2).As(B4XView).Text = "abc"
Dim j As String = $"{
data: {
key1: value1,
complex_key2: {key: value2}
},
items: [0, 1, 2]
}"$

Dim parser As JSONParser
parser.Initialize(j)
Dim m As Map = parser.NextObject
Dim value1 As String = m.Get("data").As(Map).Get("key1")
Dim value2 As String = m.Get("data").As(Map).Get("complex_key2").As(Map).Get("key")

Download link: https://www.b4x.com/android/files/beta.exe

Very Useful Iif

Thank's @Erel

Best Regards 🙏
 
Upvote 0
Top