Skip to main content
gamedev.net
🔒 Locked

Parse error ??

Started by nectron101 0 replies 2.1k views
Original Post
nectron101
nectron101
I wrote this little program using NQC.. I get a parse error on line 4. I've tried different things but nothing worked. What does "parse error" mean? And what is wrong with my code?

task main()
{
 int dist = 19; //Robot moves 19 inches
 int waiTime = ((dist - 0.2)/6.7127);
 
 if ( dist > 0 )
  {
   OnFwd (OUT_A+OUT_C);
   wait(waiTime);
   Off(OUT_A+OUT_C);
  }
  
 if (dist < 0 )
 {
  OnRev (OUT_A+OUT_C);
  wait(waiTime);
  Off(OUT_A+OUT_C);
  }

}
 
Unravelingthread
Unravelingthread
You should have recieved a warning for initializing an integer with a double.

int waiTime = ((dist - 0.2)/6.7127);

integers can't contain anything after a decimal point.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.