Code blocks error **Error: "}" expected**

I am trying to assign certain functions and calculations into the code blocks but the error “Error: “{” expected” appeared and I don’t know what is wrong with my code. I believe its a simple issue but I just can’t figure it out.

My code

def f(a,b,c,d,e,f,g)

{
return = [Imperative]

{
if((d>b) && (a>c))
{
|c|-|b|=e;
return e;
}

	elseif ((b>d && (a>c))
	{
	|c|-|b|=f;
	return f;
	}

		else ((c>a && (a>d))
		{
		|b|-|d|=g;
		return g;
		}

}
};

Thank you!

Check if there is something in this example that could help to improve your code:
image

I haven’t tried this but is the absolute value notion correct? I’m thinking you may wanna use abs() or maybe Math.abs()

Math.abs() is what I shown indeed :slightly_smiling_face:

@visualizor,

There are any things wrong in your code:

1.- The name of the function is the same as the name of one of the variables.
2.- Those invalid symbols " | " in a variable
3.- Bad variable declaration.
4.- return require a “=” symbol.
5.- The else statement doesn’t require any condiion.

def x(a,b,c,d,e,f,g)
{
   return = [Imperative]
   {
      if(d>b && a>c)
      {
         e = c-b;
         return = e;
      }

      elseif (b>d && a>c)
      {
         f = c-b;
	     return = f;
	  }

      else
      {
         g = b-d;
         return = g;
      }
   }
};

x(a,b,c,d,e,f,g);

great points! Thanks for tagging
However, I am not the OG :joy: