Android Question B4a does is support with

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys

Just typed "does b4a support with" into Google and got (from the AI)

Yes, B4A supports "with". "With" is a keyword in the B4A language, used to define properties of a class or object. It allows you to access and modify the properties of an object without repeating the object's name.

For example, in B4A you might use "with" to set multiple properties of a ListView object:
Follow with with a code example.

My simple attempts to use the with keyword failed - it highlights "with" in red so I did not continue.

Basically am I using "with" correctly or are we looking at the more AI questionable results.

Regards
Dave
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
I asked Copilot this question -
Is there an equivalent of the keyword "with", used in Delphi, in B4X
I got this answer -
B4X does not have a direct equivalent to Delphi's keyword. However, you can achieve similar functionality by using local variables to simplify code and reduce repetitive references. Here's an example:
Here is the example, which I found unconvincing -
B4X:
Dim Person As Map
Person.Initialize
Person.Put("Name", "Alice")
Person.Put("Age", 30)

' Using local variables to simplify access
Dim Name As String = Person.Get("Name")
Dim Age As Int = Person.Get("Age")

Log("Name: " & Name)
Log("Age: " & Age)[/CODE
 
Upvote 0
Top