Return problem with Serial Prompt function (?)

I'm having odd "Return" problems. Here's the code:

int read;

void setup(){ Serial.begin(9600); prompt("A or B", "0 | A", "1 | B", 0, 1, 0, 1); }

void loop(){

}

void prompt(String m1,String m2,String m3,int i1,int i2,int o1,int o2){ int a = o1; int b = o2; while(!Serial){} Serial.println(m1); Serial.println(m2); Serial.println(m3); while(!Serial.available()){} int input = Serial.parseInt(); if(input == i1){ return a; }else if(input == i2){ return b; } }

For some reason it's giving an error on return saying:

Arduino: 1.6.5 (Mac OS X), Board: "Arduino Uno"

testytest.ino: In function 'void prompt(String, String, String, int, int, int, int)': testytest:22: error: return-statement with a value, in function returning 'void' [-fpermissive] testytest:24: error: return-statement with a value, in function returning 'void' [-fpermissive] return-statement with a value, in function returning 'void' [-fpermissive]

When you post on the forum use the code tag </>.

The problem is that you declared the prompt function as void, and are trying to return an int.

Change the void prompt, to int prompt, and it should compile.

Arank:
When you post on the forum use the code tag </>.

The problem is that you declared the prompt function as void, and are trying to return an int.

Change the void prompt, to int prompt, and it should compile.

Thank you!