Coin in / out display

Hi Guys,
I am new to this site and Arduino in general. (first post)
I have worked through many of the Arduino sketches and example codes without much issue but still have trouble understanding code.
I am trying to create what I thought would be a simple coin in/out counter but have been scratching my head for a week. I have base the code on a hit counter code I found online and thought I could modify that to serve my purpose.

Here is what I am trying to do.
I have an old slot machine at home in my poor excuse of a "Man Cave" that only accepts quarters.
it doesn't have a jackpot display on it and I thought it would be a fun and relatively easy project.
It has several digital counters internally which count the coins in and out using separate counters which operate on a 24vac signal. I want to use this signal to close a set of contacts on 2 different relays to signal inputs 6 and 7 on my Arduino Uno. I have simulated the circuit using a bread board and pushbutton switches. The circuit is simple and sound. I can get it to count up or down but not both.
I am trying to get it to increase the value by +.25 when coins are inserted and decrease the value by -.25 when coins are ejected. Have redone the sketch numerous times with no luck.
I am currently getting "prevconditionBlue does not name a type" error

I have messed around with the curly brackets and think I have made problems worse. I have to admit, I don't fully understand their purpose and when they should or should not be used.

Any help would be extremely appreciated!
Here is the code as it stands right now.

//Sketch is for Arduino Uno 
  
  // include the library code:
  #include <LiquidCrystal.h>

  // initialize the library with the numbers of the interface pins
  LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

  // set up a constant for the input pins
  const int coinIn = 6;
  const int coinOut = 7;
  
  //Value to be displayed will be decimal
  float Coin = 0;

  // variable to hold the value of pin6
  int conditionBlue = 0;
  
  // variable to hold the value of pin7
  int conditionYellow = 0;

  // variable to hold previous value of pin6
  int prevconditionBlue = 0;
  
  // variable to hold previous value of pin 7
  int prevconditionYellow =0;

  void setup() {  
    // set up the number of columns and rows on the LCD 
    lcd.begin(16, 2);

    // set up the switch input pins as inputs
    pinMode(coinIn,INPUT);    
    pinMode(coinOut,INPUT);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Insert Coins");
    lcd.setCursor(0, 1);
    lcd.print("to Play");
  }

  void loop() { 
    // check the status of the coin in switch
    conditionBlue = digitalRead(coinIn);
    
    // compare the conditionBlue to its previous state
    if (conditionBlue != prevconditionBlue) {
      if (conditionBlue == LOW) {
        Coin = Coin + .25;}
        {
    // check thestatus of the coin out switch
    conditionYellow = digitalRead(coinOut);

    // compare conditionYellow to its previous state
    if (conditionYellow != prevconditionYellow) {
      if (conditionYellow == LOW) {
        Coin = Coin - .25;}
            
      }
    
    
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("Jackpot Value");
        lcd.setCursor(0, 1);
        lcd.print("$");
        lcd.setCursor (1,1);
        lcd.print (Coin);
      }
  }
    }
    // save the current switch state as the last state 
   prevconditionBlue = conditionBlue;}
   PrevconditionYellow = conditionYellow

If you would use the IDE autoformat function, you might see the problem immediately. You cannot just use curly brackets randomly. Furthermore, your code should end with a right curly bracket "}" with nothing after it except blank lines and possibly some comments.

Hey,
curly brackets are used to sample functions inside something else. So take an if-function:
it starts with an opening curly bracket { and ends with a closing one } if there is another pair of brackets inside the function using will be done if the if-statement is true. The important point is that these brackets only come in pairs. You can check it by going through your code from the beginning to the end and count the brackets. An opening one means +1 and a closing one -1. In the end you should have zero.
Arduino IDE also helps you by completing the pair of brackets if you open one and press enter afterwards.
{
|
}

and as it has been said, autoformat is your friend :slight_smile: