# Problem with 2 arrays. Code posted

**URL:** https://forum.kirupa.com/t/problem-with-2-arrays-code-posted/236587
**Category:** Uncategorized
**Created:** [August 22, 2007, 1:16am UTC](https://forum.kirupa.com/t/problem-with-2-arrays-code-posted/236587 "2007-08-22T01:16:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Lance](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@Lance](https://forum.kirupa.com/u/Lance)
#### Post date: [August 22, 2007, 1:16am UTC](https://forum.kirupa.com/t/problem-with-2-arrays-code-posted/236587/1 "2007-08-22T01:16:47Z")

</div>

I have 2 different arrays. array1 and array2. I also have 2 different buttons that load questions from the 2 different arrays into a text area called “questions”. I can’t quite figure out the code on the buttons to make it work right. It only loads the last question of the array. I want to just start at the beginning of the each array and work my way down to the last question. Here’s some of my code.

In the frame as:

```auto
a = array1.length;
c = array2.length;
b = 0
d = 0

```

On button 1:

```auto
on (press) {
	if(b<a){
	question = (array1**);
	}
	else{
		b=0;
		question = (array1**);
	}
b=b+1;
}

```

On button 2:

```auto
on (press) {
	if(d<c){
	question = (array2[d]);
	}
	else{
		d=0;
		question = (array2[d]);
	}
d=d+1;
}

```

Any help with this would be much appreciated 🙂

Thanks!
