Here is a working example I found on the web:
polyCube -ch false -n obj1;
polyCube -ch false -n obj2;
sphere -ch false -n obj3;
polyCube -ch false -n obj4;
polyCube -ch false -n obj5;
int $count;
string $cursel, $seltype;
for( $count = 1; $count < 6; $count++ ) {
$cursel = "obj" + $count + "Shape";
if( `objectType -isType "nurbsSurface" $cursel` ) break;
print( $count + "\n" );
}
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche