Problem storing wind-speed calculations to an SD card. 'x' was not declared

Hello there, here's my code in which measures wind speed. I'm having difficulty getting the final results to save onto my SD card.

#include <SD.h>
#include <SPI.h>
float refresh_rate = 0.0; //Dataloger Refresh Rate
long id = 1;
int CS_pin = 10;
#define uint unsigned int
#define ulong unsigned long

#define PIN_ANEMOMETER 2 // Digital 2

// How often we want to calculate wind speed
#define MSECS_CALC_WIND_SPEED 1000

volatile int numRevsAnemometer = 0; // Incremented in the interrupt
ulong nextCalcSpeed; // When we next calc the wind speed
ulong time; // Millis() at each start of loop().

void setup() {
Serial.begin(9600);

pinMode(PIN_ANEMOMETER, INPUT);
digitalWrite(PIN_ANEMOMETER, HIGH);
attachInterrupt(0, countAnemometer, FALLING);
nextCalcSpeed = millis() + MSECS_CALC_WIND_SPEED;

Serial.println("initializing card");
//make CS pin an output
pinMode (CS_pin, OUTPUT);

//check if card is ready
if(!SD.begin(CS_pin))
{
Serial.println("card failed");
return;
}
Serial.println("card ready");

//Write Log File Header
File logFile = SD.open("LOG.csv", FILE_WRITE);
if (logFile)
{
logFile.println(", , , ,"); //Just a leading blank line, incase there was previous data
String header = "Reading, windspeed";
logFile.println(header);
logFile.close();
Serial.println(header);
}
else
{
Serial.println("Couldn't open log file");
}
}

void loop() {
time = millis();

float windspeed = calcWindSpeed();

if (time >= nextCalcSpeed) {
calcWindSpeed();
nextCalcSpeed = time + MSECS_CALC_WIND_SPEED;
}

//data string for storing to SD card
// using CSV format
String dataString = String(id) + ", " + String(windspeed);

//open file to wrtie to
File logFile = SD.open ("LOG.csv", FILE_WRITE);
if(logFile)
{
logFile.println(dataString);
logFile.close();
Serial.println(dataString);
}

else

{
Serial.println("cant access file"); //If file cant be accessed
}
// ID number
id++;

delay (1000);
}

// Interrupt handler for anemometer. Called each time the reed
// switch triggers (one revolution).
//=======================================================
void countAnemometer() {
numRevsAnemometer++;
}

//=======================================================
// Calculate the wind speed, and display log it.
// 1 rev/sec = 1.492 mph
//=======================================================
float calcWindSpeed() {
int x, iSpeed;
// This will produce mph * 10
// (didn't calc right when done as one statement)
long speed = 14920;
speed *= numRevsAnemometer;
speed /= MSECS_CALC_WIND_SPEED;
iSpeed = speed; // Need this for formatting below

Serial.print("Wind speed: ");
x = iSpeed / 10;
Serial.print(x);
Serial.print('.');
x = iSpeed % 10;
Serial.print(x);

numRevsAnemometer = 0; // Reset counter
}
float windspeed = x;
return windspeed ;

upon verifying the code, i get the following responses:
error: 'x' was not declared in this scop
error: expected unqualified-id before 'return'

Any help will be gratefully appreciated

The two last lines are outside the funtion.
The are somewhere in nothing, so to speak.