loop problem

Can somebody tell me why this programm snippet always uses the else-case and ignores the if-cases? What can I do to hold the program until the user decides to press a key?

if (keys[VK_LEFT])
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
}

if (keys[VK_RIGHT])
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
	glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);
}

else 
{
	exit(0);
}

See NeHe’s tuts: here
Everything you need is there:)

change it to:

   if (!keys[VK_RIGHT])
{
exit(0);
}

else 
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);

} 

btw on your main function you should be doing something like

 
while(ok) { 
renderEverything(); 
if(keys[VK_UP])
ok=!ok;
}  

to exit when you press the up key