Error with this save function

Hi!
Im trying to have a save function that allows you to select the folder it goes into.

void keyPressed()
{
  if(key == 'r'){
    {
    setup();
  }
if(key ==' ')
{
  selectFolder("select a folder to process","folderSelected");
}
  }
 void folderSelected (File selection)
{
  if(selection == null)
  {
    return;
  }
  else
  {
    String dir2 = selection.getPath()+ "\\";
    save(dir2+"Painting###.jpg");
  }
  }
}

The error i’m getting at the moment is:

unexpected token: void

1 Like

you had a duplicate

  {
 {

at ‘r’ and one too much } at the very end


void keyPressed()
{
  if (key == 'r') 
  {
    setup();
  }
  if (key ==' ')
  {
    selectFolder("select a folder to process", "folderSelected");
  }
}//func 

void folderSelected (File selection)
{
  if (selection == null)
  {
    return;
  } else
  {
    String dir2 = selection.getPath()+ "\\";
    save(dir2+"Painting###.jpg");
  }
}//func
2 Likes

Thank you!
sloppy error by me D:

1 Like