B4J Question Banano Casting and comparisons of variables [SOLVED]

Star-Dust

Expert
Licensed User
Longtime User
I wrote this short code which Cast two strings into two integers.
He then compares them and the result is incorrect
B4X:
Dim TA As Int = "900"
Dim TTo As Int = "2100"
Dim B As Boolean = (TA<TTo)
vuetify.Showswal(TA & " < " & TTo & " " & b)

1633109718566.png


I wonder why. Can anyone give me a simple but convincing explanation?
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I just solved it .... not even time to ask ... I figured it was a casting problem and I solved it for the moment

B4X:
Dim TA As Int = 1 * "900"
Dim TTo As Int = 1 * "2100"
Dim B As Boolean = (TA<TTo)
vuetify.Showswal(TA & " < " & TTo & " " & b)

Even if it seems an anomalous thing to me, I considered that everything was transformed into JS and it does not have strong typing and therefore I had to help him understand .... it seems to work .... but it is an unclean solution in my opinion
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
SD, if you don't mind skimming through, in the link where you download Banano, there is also a link there to the Banano help file and it shows you the methods, classes and properties. It's a mine of wealthy content on Banano.

All the best in your journey..
Even if you read the help many things you don't understand what they are for because at that moment you don't have the problem. And most likely you don't pay attention to it

When you have the problem you don't remember that there was a method that solves it, because when you read it you didn't stop.

In any case it took time to understand that some methods cannot be used directly but must be used through banana methods precisely because of the conversion to JS (In addition to ParseInt, Regex and many others ...)

But slowly I'm starting to understand. It 's only a week that I work on it, be patient
 
Upvote 0
Top