Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi!
Please, help me before I lose my mind finally. I have this simple while loop which is working just fine most of the cases but not now. I understand that the problem is with indexes but I just cannot see the solution. Please find the example file attached.
So what I'm trying to do is to compare the arrays xf and hs. Please see also the attached picture. I would want to get points compared and sorted like in the picture. From smallest to largest. English is not my native so I thought the picture would be more than thousand words.
Feel free also to suggest more simple way to do this if you like. Bear in mind that the dimensions and number of "i" usually changes with different cases I have. But one thing doesn't change and it's the number of equally divided spaces = 8.
Thanks a lot for your advice in advance!
-Harri
Solved! Go to Solution.
Its sure bad habit to use the same name for the sum index and its end value, as ttokoro already remarked.
I have not looked at your program in detail but provide a solution depending of how I understood what you actually are after.
I prefer using small utility functions which do just one task and combine them to get what is needed.
See if the following (Prime 9 file attached) helps
At first you should use the number >= i in your program.
Its sure bad habit to use the same name for the sum index and its end value, as ttokoro already remarked.
I have not looked at your program in detail but provide a solution depending of how I understood what you actually are after.
I prefer using small utility functions which do just one task and combine them to get what is needed.
See if the following (Prime 9 file attached) helps
Werner's file converted to Prime 8.
Success!
Luc
Thank you Werner! I would say your solution is "little" more simple and therefore better than mine 😀. I get that it's easier to check and control the calculations if the functions are done like you have.
Please find also the file in where I managed to fix the problem also. I added some restrictions more to indexes and now it seems to work at least with those variables. But I will change my functions to match your examples.