Type inference undeclared variable