# How do I use the J and x variables in Thunkable?

**URL:** https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891
**Category:** Questions about Thunkable X
**Created:** [April 18, 2021, 10:27pm UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891 "2021-04-18T22:27:03Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)
#### Post date: [April 18, 2021, 10:27pm UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/1 "2021-04-18T22:27:03Z")

</div>

Hi  
I am trying to google around and want to learn about the J and X variables in Thunkable. How are they ment to be used?

ex, “For each Item J in list, do”…  
I understand it’s a loop but what does the J stands for?

Thanks!

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [April 18, 2021, 10:49pm UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/2 "2021-04-18T22:49:40Z")

</div>

The “j” is just a variable that holds each list item as the loop iterates.

So let’s say you have a list with items {1,22,83}. If you run this code:

```auto
For each item j in list do
     set label's text to j
     wait 1 second

```

Then you will see…  
1  
22  
83

…with a second pause between each number.

---

<div class="post-metadata">

### Author: ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)
#### Post date: [April 19, 2021, 5:41am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/3 "2021-04-19T05:41:19Z")

</div>

Hi.  
Thanks for the explanation! So I use this within an existing list if I want to do anything with the items in that list? And the J variable will hold these items until I have told what to do with them?  
Is that correct?

Does it stands for anything (the J) or is it just like a x/y in a diagram?

Thanks!

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [April 19, 2021, 6:09am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/4 "2021-04-19T06:09:26Z")

</div>

Yes, that’s correct.

The “j” does not stand for anything. It’s similar to x or y as a math variable. In fact, you can create your own loop variables and call them whatever you want. But it’s easiest to just use the default “i” or “j” variables.

---

<div class="post-metadata">

### Author: ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)
#### Post date: [April 19, 2021, 7:20am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/5 "2021-04-19T07:20:07Z")

</div>

Great, thanks!

I have noticed there is an ”x” in that block as well.  
Is that the same thing as the ”j”? Is it to use different loops with the same material/list/items?

---

<div class="post-metadata">

### Author: ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)
#### Post date: [April 19, 2021, 8:26am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/6 "2021-04-19T08:26:55Z")

</div>

Hi there,

The j variable is a local variable used in loops, as seen in the [Control blocks](https://docs.thunkable.com/control#loops).

The x variable is a local variable used in [functions](https://docs.thunkable.com/functions).

Both of these can be renamed, those are just the default names.

---

<div class="post-metadata">

### Author: ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)
#### Post date: [April 19, 2021, 10:38am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/7 "2021-04-19T10:38:10Z")

</div>

Thanks Jane! Just out of curiosity, are these variabels “hardcoded” to functions/loops? I mean, is it just a matter of order or is it simply not not possible to use j for functions and vice versa in a technical perspective ? Thanks

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [April 19, 2021, 10:44am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/8 "2021-04-19T10:44:35Z")

</div>

You can use whatever variable you want in whatever place. Click in the variable, for example, “j” and the popup list has a rename option.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/28515c8b1d664a83bf6c77f909cda2a9809a9d80.png)

---

<div class="post-metadata">

### Author: ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)
#### Post date: [April 19, 2021, 11:04am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/9 "2021-04-19T11:04:40Z")

</div>

Ok so its just a matter of order then? This is how people likes to use it: x for functions and j for loops?

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [April 19, 2021, 11:05am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/10 "2021-04-19T11:05:19Z")

</div>

👍

---

<div class="post-metadata">

### Author: ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)
#### Post date: [April 20, 2021, 8:52am UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/11 "2021-04-20T08:52:06Z")

</div>

These are just conventions! You’ll see similar default naming strategies in guides for other programming languages. Another classic is using i in the ‘count with [i] from [1] to [10] by [1]’ block, also seen in the [control blocks.](https://docs.thunkable.com/control#loops)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:25pm UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/12 "2024-11-08T13:25:07Z")

</div>



---

<div class="post-metadata">

### Author: ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)
#### Post date: [December 19, 2024, 5:00pm UTC](https://community.thunkable.com/t/how-do-i-use-the-j-and-x-variables-in-thunkable/1231891/13 "2024-12-19T17:00:39Z")

</div>


