String abc;
Select firstOnly vendTable where vendTable.Id == 'US-111';
if(vendTable){
abc = vendTable.Name;
}
EDIT:
VendTable vendTable; str abc; select firstOnly vendTable where vendTable.AccountNum == 'US-111'; if (vendTable) { abc = vendTable.name(); }
My question is: is the if statement necessary after the select statement.
I'm thinking that the if statement is unnecessary and i can just do the asssignment directly. (abc = vendTable.Name).
if vendTable returns empty, then abc will default to empty string. Wonder if my understanding is correct here.