error calling void function

I am new to Arduino and most programming in general. I wrote a program for a basic calculator that I plan on making. I used void functions for different parts of the code. for example, I have made a function where the code reads the value of the first number the user inputs. I keep getting the error message "/tmp/090507220/Calculator/Calculator.ino:125:3: error: expected '}' before 'if'

exit status 1" I have no clue what to do. it also displays "CalculatorVal2 not declared in this scope"(calculatorval2 is the name of a function) I am calling the function in an if statement. Can u not do that?. This is my first real project, any help would be greatly appreciated.

Hello ErgonomicGrip

Please post ALL your code.

Regards,
bidouilleelec

it also displays "CalculatorVal2 not declared in this scope"(calculatorval2 is the name of a function)

If calculatorval2 is the name of the function, the compiler would not be complaining about CalculatorVal2 not being declared in this scope. Case matters.

Post your code AND the EXACT error messages - not your incorrect paraphrasing of them.

Use the copy code for forum in the IDE, then paste directly into your reply.

You probably have too many { or too few }

Common compiler errors caused by mismatched brackets:

"does not name a type" or
"expected declaration before" or
"expected unqualified-id before"
Usually means you forgot a '{' or put in an extra '}' in the previous function. Since all of the open brackets have been closed, the compiler is looking for further global declarations (variables or functions). If it finds something that looks like executable code instead of a global declaration it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"a function-definition is not allowed here before '{' token"
(can cause: "'functionName' was not declared in this scope")
Usually means you forgot a '}' or put in an extra '{' in the previous function. Since a set of brackets has not been closed yet the compiler is looking for more code to put in the function. You can't declare a function inside a function so if the compiler finds a function definition it emits an error. Make sure that the brackets in the preceding function are in matching pairs '{' followed by '}'.

"expected '}' at end of input"
Usually means you forgot a '}' or put in an extra '{' in the last function in the sketch. Since a set of brackets has not been closed yet, the compiler is looking for more code to put in the function. When it hits the end of the file instead it emits an error. Make sure that the brackets in the last function are in matching pairs '{' followed by '}'.

"expected primary-expression before '}' token"
Usually means you have an incomplete statement before a '}'. The block statement (between '{' and matching '}') can only contain complete statements.

Thanks for the advice, heres the link to the code Arduino Cloud

void calculatorval2 {

try

void calculatorval2() {

There is some more debugging after that.

lcd.print("Then hit next ");
lcd.print(val1);

lcd.print(val1);
lcd.print( "/" );
lcd.print(val2);
and more of that.

else if(opval >= 502 && opval < 753){
Leo..

ErgonomicGrip:
Thanks for the advice, heres the link to the code https://create.arduino.cc/editor/ErgonomicGrip/080db67e-156a-4689-9214-a23e57f9c15d/preview

What advice you seem to ignore mine

Grumpy_Mike:
Use the copy code for forum in the IDE, then paste directly into your reply.

void calculatorval2
{
  if (next == HIGH)
  {

You forgot to put "()" after the function name to let the compiler know you were declaring a function.

    lcd.print("Then hit next  "val1);

You can't put multiple values in a single print(). Each one has to be a separate print(). Change to:

    lcd.print("Then hit next  ");
    lcd.print(val1);
    else if (opval >= 502 && < 753)

The compiler doesn't know what you intended to be on the left side of the '<'. You have to tell it:

    else if (opval >= 502 && opval < 753)
   lcd.print(val1 "/" val2);

Again, only one item per print:

   lcd.print(val1);
   lcd.print("/");
   lcd.print(val2);

Same for the other three operators.

Some places you spelled "val1" and "val2" as "va11" and "va12". One place you spelled "val2" as "Val2".

Lots of missing semicolons after "delay(750)"

After fixing all of those I got it to compile.

Thanks for the help!