|
|
|||||||
Can someone explain this... Code: @kix $i=0 ? ("test"<>$i) ? ($i<>"test") The first test line returns 1 The second test line returns 0 Why? Shouldn't they return the same value? |
||||||||
|
|
|||||||
I'm guessing this is KiX's auto intepreter stuff. Assuming correctly $i is an Integer so the second test correctly displays 0. The first test should not pass at all. I wish KiX would error out when comparing different types of variables. (PowerShell does) |
||||||||
|
|
|||||||
This is actually one of the advantages of KiXtart. Teaches you to correctly declare/use your variables. This variable behavior is demonstrated in the "Expressions" section of the KiXtart Manual. |
||||||||
|
|
|||||||
I guess I should have put the comparison script in too... Code: @kix $i=1 ? ("test"<>$i) ? ($i<>"test") Both test lines return 1 here... |
||||||||
|
|
|||||||
anyways, like said, it's behaving correctly. "test"<>$i converts $i to string. "test" is different than "0" or "" or "1" $i<>"test" forces conversion from string to integer. there is0 no numeral part in "test" so the comparison in your examples is: $i<>0 |
||||||||
|
|
|||||||
Remember that all KiXtart types are VARIANT, as documented in the manual. This means that it is behaving correctly when promoting variables to different sub-types, and IIRC there are similar processes in other languages which support variants. Strongly typed variable support has its place, but it would probably hinder KiXtart more than provide anything useful. If we had direct access to things like DLL function calls it would be more important. This auto-conversion of variant types is probably the reason many of us still use short form Hungarian notation for variable names when it has largely fallen out of favour. |
||||||||
|
|
|||||||
Hmm... and all this time I thought I was using Hunarian Notation as a tribute to my Hugarian ancestry! G- |
||||||||
|
|
|||||||
wtf? hunarian? hugarian? lol! |
||||||||
|
|
|||||||
I wondered if anyone would catch that.. Figures it would be Lonk.. I still think it's funnier my way. G- |
||||||||
|
|
|||||||
yea |
||||||||
|
|
|||||||
I saw it, but didn't want to make any smart remarks. Being from New Jersey is bad enough. |
||||||||
|
|
|||||||
New Jersey? So, Newark and New York isn't your fault? |
||||||||
|
|
|||||||
Ugh - I'm smack-dab between the two - NYC is 10 miles due East, while Newark is 10 miles due South. It could be worse, but not by much.. Glenn |