Read, re-define and use variable - WeMos v Arduiino

Hope I have correct category this time.

I am using and arduino uno for this particular project, but have code for a similar project where a WeMos was used.
I am reading from a gyro device and defining which side of a box is on top - I have done this another way but this looks soo much easier and more streamlined, but gives the error 'getside was not declared in this scope' rather than finding/defining it. it is not mentioned anywhere else in the original code.
code excerpt is

    side = getSide();

other stuff defined by side etc

int getSide()
{
  accel.update();
  int x=pos(accel.x());
  int y=pos(accel.y());
  int z=pos(accel.z());
  
  if(x==1 && y==0 && z==0)return 0;
  if(x==2 && y==0 && z==0)return 1;
  if(x==0 && y==1 && z==0)return 2;
  if(x==0 && y==2 && z==0)return 3;
  if(x==0 && y==0 && z==1)return 4;
  if(x==0 && y==0 && z==2)return 5;
  return -1;
  
}

int pos(int val)
{
  if(val<-240)return 1;
  if(val>-40 && val < 40)return 0;
  if(val>240)return 2;
  return -1; 
}

I am guessing there is a syntax difference I have not figured out

Thanks
Phil

Post your complete sketch, otherwise the problem cannot be seen in context

#include <Wire.h>
#include <MMA8453_n0m1.h>

int side = -1;  // side of the cube

MMA8453_n0m1 accel;
bool winner = false;
int sideOld=-1;
int codeOk[6]={4,3,2,1,5,0};
int codeIn[6]={-1,-1,-1,-1,-1,-1};

void setup()
{
  accel.setI2CAddr(0x1C); 
  accel.dataMode(true, 2); 

}
 
void loop()
{
  

    side = getSide();
    if( side != sideOld && side >= 0)
    {

      delay(100);
      Serial.println("Side: " + String(side));  //then remove
      sideOld = side;
      for(int i=0;i<5;i++)
        codeIn[i]=codeIn[i+1];
      codeIn[5]=side;
      checkCode();       
    }
    delay(300);


void checkCode()
{
  int summ=0;
  for(int i=0;i<6;i++)
    if(codeIn[i] == codeOk[i])
      summ++;
  if(summ==6)
  {
    win();
  }
}

int getSide()
{
  accel.update();
  int x=pos(accel.x());
  int y=pos(accel.y());
  int z=pos(accel.z());
  
  if(x==1 && y==0 && z==0)return 0;
  if(x==2 && y==0 && z==0)return 1;
  if(x==0 && y==1 && z==0)return 2;
  if(x==0 && y==2 && z==0)return 3;
  if(x==0 && y==0 && z==1)return 4;
  if(x==0 && y==0 && z==2)return 5;
  return -1;
  
}

int pos(int val)
{
  if(val<-240)return 1;
  if(val>-40 && val < 40)return 0;
  if(val>240)return 2;
  return -1; 
}
int win(){
  Serial.println("WIN");
  winner = true;
}

The closing brace for the loop() function is missing.
It should be before the definition of the checkCode() function

Thanks

feeling a bit stupid looking in the wrong place for more complex issue - but makes perfect sense now!

If you Auto format the code in the IDE then the problem is immediately obvious because the definition of the checkCode() function does not start on the left margin

void loop()
{
  side = getSide();
  if ( side != sideOld && side >= 0)
  {
    delay(100);
    Serial.println("Side: " + String(side));  //then remove
    sideOld = side;
    for (int i = 0; i < 5; i++)
      codeIn[i] = codeIn[i + 1];
    codeIn[5] = side;
    checkCode();
  }
  delay(300);
  void checkCode()
  {