Issue
I tried defining a const by typing in
const loinc = "http://loinc.org";
After pushing my code, the build fails and I get this error: illegal start of expression
List<ObservationComponentComponent> listComponent = new ArrayList<>();
// loop through the different types in array
for (int i = 0; i < body.length; i++) {
DeviceBloodPressureBody curBody = body[i];
ObservationComponentComponent component = new ObservationComponentComponent();
// set LOINC codes for components
CodeableConcept observationComCodeConcept = new CodeableConcept();
Coding observationComCodeCoding = new Coding("", "", "");
const loinc = "http://loinc.org";
if (curBody.getDataType().equals("diastolic")) {
observationComCodeCoding = new Coding(loinc, "88462-4", "Diastolic blood pressure");
} else if (curBody.getDataType().equals("systolic")){
observationComCodeCoding = new Coding(loinc, "8480-6", "Systolic blood pressure");
} else if(curBody.getDataType().equals("pulse")){
observationComCodeCoding = new Coding(loinc, "8867-4", "Heart rate");
}
observationComCodeConcept.addCoding(observationComCodeCoding);
component.setCode(observationComCodeConcept);
Solution
That way of defining a constant is for Javascript, not Java.
You can define one by changing
const loinc = "http://loinc.org";
For
final String loinc = "http://loinc.org";
Answered By - Brugui
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)