need help, want to call program in void setup to voif loof

so this day i spending few hours to solve how to make intruction that im just need to call it to void loop,
i mean i write down my program on void setup, after that in void loop i just need to make if statement, so example if a<b i call foward();. and foward is program that i write in void setup. to understand what i mean see this program.

void setup() {
  // put your setup code here, to run once:
void motion1() {
digitalWrite(12, LOW); digitalWrite(13,HIGH);delay(100);
digitalWrite(12, LOW); digitalWrite(13,LOW);delay(100);}
void motion2(){
digitalWrite(12, HIGH); digitalWrite(13,LOW);delay(100);
digitalWrite(12, LOW); digitalWrite(13,LOW);delay(100); }

void loop() {
  // put your main code here, to run repeatedly:
int valuesensor1 = analogRead(A0);
Serial.print("nilai Sensor =");
if(valuesensor1 > 500){motion1();
if(valuesensor1 < 500){motion2();

in cvavr its wok, but i need it for arduino IDE, thanks a lot

You can’t define a function inside another function.

in cvavr its wok,

I don’t understand that phrase

that is code vision avr, one of most programming software for atmega avr

Is that just another way of saying “defective”?

Hint: some dialects of C allow you to define functions inside other functions, like you have done with motion1 and motion2.
However, this limits their scope ( which may be desirable) to that function.

is that mean i should make it in one function? thanks for your respond, its mean a lot

Just define motion1() and motion2() outside of setup().

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.