Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Double loop

Featured Replies

not sure what to call this but I would like to turn these two arrays:

array1:  A, B, C

array2:  1, 2, 3, 4, 5, 6, 7, 8

 
into this:

1A, 2B, 3C,

4A, 5B, 6C,

7A, 8B

 

Was playing with:  

GetValue ( array2 ; loop  ) &  GetValue ( array1 ; mod ( loop ; ValueCount ( array1 ) )  ) 

Just get stuck on

mod ( 3 ; 3 )

which I can handle with an if statement but would rather let math solve it.

It works with Zero indexed arrays... So your second half should be  ... &  GetValue(array1; (mod(loop-1;valueCount(array1))+1) 

 

loop -1 will simulate zero index array and give you the correct result if you do some shifting:

mod(0;3) = 0 ->add 1 to get 1 (a)

mod(1;3)=1 -> 2(B)

mod(2;3)  = 2 >-3©

 

 

Hope this helps.

  • Author

excellent.... thanks GisMo

Hi Gismo,

 

We have a Code button that will allow you to post your code so that it look likes you intended. it is the <>  above in the Reply to this topic.

@rivet, glad that did the trick for you!

 

 

@Lee, Thanks....now where is the "edit" button on my post?

It should appear, along with (Report Blog this, Edit MultiQuote and Quote very light gray in the body.

If you don’t see them, just make a new reply to this post and use the Code button and repost the code in it.

Edited by Lee Smith

@Lee I don't see it for my first post, but I do see them for my recent post earlier today. Is there a reason for that?  I'll repost my answer below with code brackets.  


Answer: 

GetValue(array1; (mod(loop-1;valueCount(array1))+1) 

It works with Zero indexed arrays... So your second half should be  ... &  GetValue(array1; (mod(loop-1;valueCount(array1))+1) 

 

loop -1 will simulate zero index array and give you the correct result if you do some shifting:

mod(0;3) = 0 ->add 1 to get 1 (a)

mod(1;3)=1 -> 2( :cool:

mod(2;3)  = 2 >-3©

 

 

Hope this helps.

@Lee I don't see it for my first post, but I do see them for my recent post earlier today. Is there a reason for that?

"

I think there is a time limit for members to edit their post.

My guess is 24 hours, and or if there has been replies to your post.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.