I have something like the following in an Apex class:
public class Picker
{
public static List<Type__c> getTypes()
{
List<Type__c> list = [select Name from Type__c where Name = 'Person'];
return list;
}
}
Which gives the following error:
Error: Compile Error: unexpected token: 'List' at line 5 column 8
However, turning into the following is fine:
public class Picker
{
public static List<Type__c> getTypes()
{
return [select Name from Type__c where Name = 'Person'];
}
}
Why does the first code segment not work?