using ping sensor with the blink without delay while sweeping a servo

im trying to sweep my sensor back and forth and take a reading at each stop im using the blink without delay , ping and sweep codes together. im not sure if im on the right path could someone give me a nudge please

#include <Servo.h>
Servo myservo;
// constants won't change. Used here to 
// set pin numbers:
const int pingPin = 8;
Servo scanServo;
// Variables will change:
int pingPinState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated
int pos = 0; 
// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 15;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(pingPin, OUTPUT); 
 Serial.begin(9600); 
scanServo.attach(11); 
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.
 long duration, inches, cm;
 pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
 pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
 inches = microsecondsToInches(duration);
   
  for (pos =-60 ; pos <= 100; pos ++) //scan IR sensor from 35 to 165 degs from left to right
  { 
    scanServo.write (pos); //writes the position to scanning servo
    delay(3); //give it time to get there
  }

  for (pos = 60; pos <= 180; pos ++) //scan IR sensor from 35 to 165 degs from left to right
  { 
    scanServo.write (pos); //writes the position to scanning servo
    delay(3); //give it time to get there
  } 
   for (pos = 180; pos >=60; pos --) //scans right to left
  {
    scanServo.write (pos);
    delay (3);
      for (pos = 100; pos >= -60; pos --) //scan IR sensor from 35 to 165 degs from left to right
  { 
    scanServo.write (pos); //writes the position to scanning servo
    delay(3); //give it time to get there
  }
    
    
  Serial.print(inches);
  Serial.print("in, ");
  Serial.println();  
  
  // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (pingPinState == LOW)
      pingPinState = HIGH;
    else
      pingPinState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(pingPin, pingPinState);
 

}
  }
 }
  long microsecondsToInches(long microseconds)
{
  return microseconds / 74 / 2;
}

You're not taking a reading at each stop. You're taking a reading, doing a lot of moving, printing results, and starting over.

To get a reading at each stop you need to take a reading between moving to one position and moving to the next.

How many readings did you want? You only ever print one each time through loop().

Does Servo.write accept negative angles?

ok john so i need to put the ping code after each servo movement correct cause i want a reading at strait ahead full right and full left, but the servo needs the delay to move so i am trying to time the ping with the spot where the servo stops at. like say 180 90 and 0 figurativly. and yes awol for some reason it will accept negative numbers i dont know why but it does. what id really like to do is have the ping sensor as a function but i cant get the arduino to perform the math properly when its used as a function instead of being in the loop.