+ Start a Discussion
Becky Miller 15Becky Miller 15 

Compile Error

Error: Compile Error: Illegal variable declaration: oli.Annual_Revenue_Upside__c at line 109 column 70

Here is the line of code: (it is the first line of code)  Annual_Revenue Upside is a Number .  I am not sure what the Illegal Variable Declaration is. do I need to start over and make the field a Currency?

    private Decimal add(Decimal rollup, Decimal UnitPrice, Decimal oli.Annual_Revenue_Upside__c)
    {
        UnitPrice = (oli.Annual_Revenue_Upside__c != null) ? oli.Annual_Revenue_Upside__c : UnitPrice;
        return rollup + ((UnitPrice == null) ? 0 : UnitPrice);
    }
 
Best Answer chosen by Becky Miller 15
Prateek Singh SengarPrateek Singh Sengar
Hi Becky,
You methods signature is saying Decimal oli.Annual_Revenuw_Upside__c, method parameters should be variables and not reference to object fields

1st Change in method signature
Decimal oli.Annual_Revenue_Upside__c
to
Decimal annualRev

2nd Change:
UnitPrice = (oli.Annual_Revenue_Upside__c != null) ? oli.Annual_Revenue_Upside__c : UnitPrice;
to
UnitPrice = (annualRev != null) ? annualRev : UnitPrice;