EWWWW! GROSS!
Oct. 7th, 2004 04:37 pmI have written the most gross and messy IF THEN ELSE statement of all time! The masters of ASP would kill me!
If vFName<>"" Then
Response.Write("Thank you " & vFName & " " & vLName & ".
")
Response.Write("You have applied for a loan for a Car.
")
If vFName="REGIS" Then
Response.Write("You make waaay too much!
")
Response.write("Try shopping here instead.")
Else
If vIncome >= 30000 then
If vIncome < 1000000 Then
Response.Write("Your loan has been approved.")
Else
Response.Write("You make waaay too much!
")
Response.write("Try shopping here instead.")
End If
Else
Response.Write("Sorry, we can't approve your loan at this time.")
End If
End If
End If
To translate, this is what it says in English:
Check to see if the person entered a first name.
If they didn't, STOP.
If they did, display the full name and what loan they applied for.
If this person's first name is Regis, give them a message to annoy them, then STOP.
If his/her first name isn't Regis, check the amount of income.
If the income is under $30000, then tell them they suck, then STOP.
If the income is over $30000, then see if it's over $1000000.
If the income is over $1000000, give them a message to annoy them, then STOP
If the income is under $1000000, appove them, then STOP.
Fun stuff, no? It's not 100% finished yet, as I need build it a choice of what the loan is for. After that, I'm going to comment the heck out of it to remember what it does. :-\
I couldn't think of a cleaner way to do it. Case statements wouldn't work, and I don't know if AND/OR statements work in ASP. If they do, I can group the Regis/$1000000 statement with a little restructing.
All and all, it's not a hard assignment, just messy.
If vFName<>"" Then
Response.Write("Thank you " & vFName & " " & vLName & ".
")
Response.Write("You have applied for a loan for a Car.
")
If vFName="REGIS" Then
Response.Write("You make waaay too much!
")
Response.write("Try shopping here instead.")
Else
If vIncome >= 30000 then
If vIncome < 1000000 Then
Response.Write("Your loan has been approved.")
Else
Response.Write("You make waaay too much!
")
Response.write("Try shopping here instead.")
End If
Else
Response.Write("Sorry, we can't approve your loan at this time.")
End If
End If
End If
To translate, this is what it says in English:
Check to see if the person entered a first name.
If they didn't, STOP.
If they did, display the full name and what loan they applied for.
If this person's first name is Regis, give them a message to annoy them, then STOP.
If his/her first name isn't Regis, check the amount of income.
If the income is under $30000, then tell them they suck, then STOP.
If the income is over $30000, then see if it's over $1000000.
If the income is over $1000000, give them a message to annoy them, then STOP
If the income is under $1000000, appove them, then STOP.
Fun stuff, no? It's not 100% finished yet, as I need build it a choice of what the loan is for. After that, I'm going to comment the heck out of it to remember what it does. :-\
I couldn't think of a cleaner way to do it. Case statements wouldn't work, and I don't know if AND/OR statements work in ASP. If they do, I can group the Regis/$1000000 statement with a little restructing.
All and all, it's not a hard assignment, just messy.