Copy link to clipboard
Copied
Hello,
I am getting two errors, well four but three are the same. 1083 && 1084.
here is my code, can someone look over it and tell me what I am doing wrong. I am fairley new to Flash Builder so please no harassement.
//Check The Login
var userName: String= "requestofone";
var passWord: String= "robots96";
if (userName == "requestofone" && passWord == "robots96"){
trace("Welcome requestofone")
}else{ (userName != "requestofone")
trace("User not found. Try again.")
}else if{ (passWord != "robots96")
trace("Password does not match our records.");
}
//Tire Pressure
var frontTires:Array = ['43', '43'];
var rearTires:Array = ['45', '45'];
if (frontTires:Array != uint: 43 && rearTires:Array != uint: 45){
trace("Get Your Tires Checked Out")
}else{ (frontTires:Array == uint: 43) && (rearTires:Array == uint:45)
trace("Tires pass the spec")}
Description | Location | |||
1083: Syntax error: else is unexpected. | line 48 | |||
1084: Syntax error: expecting rightparen before colon. | line 56 | |||
1084: Syntax error: expecting rightparen before colon. | line 58 | |||
1084: Syntax error: expecting rightparen before colon. | line 58 |
I have been trying to figure this out for a while now. Please help.
Copy link to clipboard
Copied
Not to be nasty or "harass", but you need to go back and learn the syntax. Each line of code should end with a semicolon, and I'm also not sure what you are trying to accomplish with your "else{(userName != "requestofone")". Are you trying to do a conditional test? If so you need to use an "else if". That said, the "else if" you do use is incorrect. The parens should come out side the curly braces like you did for the initial "if" condition, and the "else if" needs to come before your final "else" since that is where the flow will go when no previous condition is met.
Example:
if (a == b){
trace("do something");
}
else if (b == c){
trace("do something different");
}
else{
trace("do some default thing");
}
I hope this helps.