Somehow != doesn't work as I think it should



  • i found out you can not do not eqal !=...... it does not work!

    repare IT

    [Edit: Thread title changed -- @Wieland]



  • @07Pepa Works for me... here's an example from one of my apps:

                        if (button == "Enter" && pin != '') {
                            pwField.accepted(pin)
                            pwFieldText.text = ""
                            pin = ''
                            return
                        }
    

    What exactly is not working for you? Show us the code, maybe you are using it wrong or what you are expecting is incorrect based on your variable state.



  • @07Pepa

    1. Certainly you can, and it works.
    2. This is not a Qt Company's support forum, this is volunteer based user-to-user forum, so we mostly don't do repairs.
    3. If your code doesn't work, show it to us and maybe we can help.


  • I've had support log a call for something that maybe this:
    https://bugreports.qt.io/browse/QTBUG-59204 - is this symptoms you mean?

    It's possible to have the line indicator confused - but the actual execution is still ok.
    I found removing all spaces in these circumstances seemed to make things happy.

    It's just my guess... This is literally the worst request for help I've could imagine - a "doesn't work - fix it" call, totally horrid.

    Maybe provide some code, contex, steps to reproduce ... and if you go to that much effort you mose well have searched for and logged a bug report (if you do actually have something) that way it's better for you and everyone else too.



  • One could also speculate that in some cases !== should be used instead of != because the former means something like "not identical to" and the latter "not similar to" in javascript.


Log in to reply