vrmetro
asked on
Print else if, in an else statement
Hello,
The code below is used to switch between outputs based on environment. My question is will the internal "else if" print or will that mess up the script? If so how cna I print the internal else if's?
if ("test.findwhere.com:9021" .equals(re quest.getR emoteHost( ))) {
// TEST
else if (Country.equals("XS"))db_C ONFIGTYPE = "sxlof"; <<--- NEED THIS TO PRINT
}
The code below is used to switch between outputs based on environment. My question is will the internal "else if" print or will that mess up the script? If so how cna I print the internal else if's?
if ("test.findwhere.com:9021"
// TEST
else if (Country.equals("XS"))db_C
}
if ("test.findwhere.com:9021".equals(request.getRemoteHost())) {
// TEST
else if (Country.equals("XS"))db_CONFIGTYPE = "sxlof";
} else if ("staging.findwhere.com".equals(request.getRemoteHost())){
// STAGING
else if (Country.equals("XS"))db_CONFIGTYPE = "sxlof";
} else {
// LIVE
else if (Country.equals("XS"))db_CONFIGTYPE = "sxwf";
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Here's a better glimps
if (Country.equals("US"))db_CONFIGTYPE = "sulof";
else if (Country.equals("DE"))db_CONFIGTYPE = "edlof";
else if (Country.equals("CA"))db_CONFIGTYPE = "sulof";
else if (Country.equals("AU"))db_CONFIGTYPE = "ualof";
/***********************************************
And here's the switch!!
***********************************************/
if ("test.findwhere.com:9021".equals(request.getRemoteHost())) {
// TEST
else if (Country.equals("XS"))db_CONFIGTYPE = "sxlof";
} else if ("staging.findwhere.com".equals(request.getRemoteHost())){
// STAGING
else if (Country.equals("XS"))db_CONFIGTYPE = "sxlof";
} else {
// LIVE
else if (Country.equals("XS"))db_CONFIGTYPE = "sxwf";
}
/*** Done switching ***/
else if (Country.equals("KZ"))db_CONFIGTYPE = "zklof";
else if (Country.equals("AC"))db_CONFIGTYPE = "calof";
DebugLog.write("Country2 = "+Country+FileNwline);
ASKER
Would something like this work... sorry cant test myself right now. :(
if ("test.findwhere.com:9021".equals(request.getRemoteHost())&&(Country.equals("XS"))) {
// TEST
db_CONFIGTYPE = "sxlof";
ASKER
Sorry I missed the rest of his first code example. Ty
Ah. I think perhaps this is what you want:
if (Country.equals("US")) {
db_CONFIGTYPE = "sulof";
} else if (Country.equals("DE")) {
db_CONFIGTYPE = "edlof";
} else if (Country.equals("CA")) {
db_CONFIGTYPE = "sulof";
} else if (Country.equals("AU")) {
db_CONFIGTYPE = "ualof";
} else if (Country.equals("XS")) {
/***********************************************
And here's the switch!!
***********************************************/
if ("test.findwhere.com:9021".equals(request.getRemoteHost())) {
// TEST
db_CONFIGTYPE = "sxlof";
} else if ("staging.findwhere.com".equals(request.getRemoteHost())) {
// STAGING
db_CONFIGTYPE = "sxlof";
} else {
// LIVE
db_CONFIGTYPE = "sxwf";
}
/*** Done switching ***/
}
else if (Country.equals("KZ")) {
db_CONFIGTYPE = "zklof";
} else if (Country.equals("AC")) {
db_CONFIGTYPE = "calof";
}
DebugLog.write("Country2 = " + Country + FileNwline);
ASKER