When creating different patterns on TurtleStitch it is good to use variables to help shorten your code.
Here is how you can create a variable and how it is used to create a pattern.
To start off, you need to go the variable section and click on make a variable. When you do this, a box will come up to name your variable. The variable should have a valid name so when you come back and look at your block of code, the variable name makes sense to you.
In this example, I will be calling the variable sideLength. Then click OK.
If you stay in the variable section, you will see two buttons, the set [] to [] and change [] by [].
You can set sideLength to any number you would like. Try different numbers and see what your pattern looks like. If you want to make some sort of spiral and you want it to get bigger each loop, you can change sideLength by 10 or any number that you would like.
You can also insert this variable into different motion blocks.
This is the variable section:
Now, I will show you how to create a block of code using variables.
You are going to need your reset and repeat button from the control section. Set repeat to 12.
You will also need a type of stitch, in this case, I will be using a running stitch by 10. Insert this stitch button between reset and repeat.
Below your running stitch button, you will need to inset a set [sideLength] to [30]. sideLength is my variable I created, and I am setting that number to 30.
Get a move steps button and where you enter a number, you will insert you sideLength variable into there. Put that button into your repeat loop.
After that you will need turn degrees set that to 120.
The last step is to grab the change [] by [] button from the variable section and put in sideLength and a number of your choice. I will be putting in 20.
Now click your block of code and you should get the following pattern:
Created by: Hope Boyle