Question

How to do two list variables as Ascending order by using only loop and if conditions

  • 31 January 2024
  • 3 replies
  • 57 views

Badge +1

Hi All,

I have one requirement 

List1=4,9,2

List2=8,15,6

Output List=2,4,9,6,8,15( Ascending order)

This requirement can be done only if conditions or loop Commends not to use the any sort or quires or programming languages.

 

Regards,

Sumanth

 


3 replies

Badge

One thing you could try is to use a loop for each list to add the list values into a data table variable and then use the sort action under Data Table. You can then leave it in the data table format or if you need a list then use a loop for each row in the data table to put it into a new list.

Badge +1

Thanks Rob. But i need to use only loop and if conditions. Not to use the sort commend. Kindly recommend any option we can go only using loop and if conditions.

 

Regards,

Sumanth

Userlevel 4
Badge +14

Hi @sumanth.v ,

Initialize a counter.

You can use the while loop to check the counter has not been equal to the length of the list.

Post that you can create two counters which will work as start and end(list size) position. After that check the first and last and which is greater, keep it in a temporary list. Further also check the less than and data present in temporary list. Please check and revert whether the logic worked or not.

Reply