Ask coding questions

← Back to all posts
Please check this problem, keep getting failed message. Thanks
KevinWang19 (0)

// In this exercise, you will be given a variable, it will be called: age
// You are also given another variable called: typeOfLicense;
// Using an if/else if/else statement assign typeOfLicense to:
// 'Full License' if age is greater than or equal to 16,
// 'Permit' if age is equal to 15,
// 'None' if age is less than 15

if (age >= 16){
typeOfLicense = 'Full License';
} else if (age = 15){
typeOfLicense = 'Permit';
} else if (age < 15){
typeOfLicense = 'None';
}

Commentshotnewtop
KevinWang19 (0)

Thank you. I got it.

vedprad1 (732)

On Line 3, you put only one equal sign. However, if this is in either java or javascript (I am not familiar in other languages), you need to have two equal signs because you are comparing the values, not assigning one to another.

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!

vedprad1 (732)

@KevinWang19 : Great! Could you please mark my answer as correct? Thanks!