import 'dart:io';
main() {
print("What's your cat's age?");
var age = int.parse(stdin.readLineSync()!);
if (age == 1){
print("15");
}
if (age == 2){
print("24");
}
if (age == 3){
print(24 + 4*2);
}
if (age > 3){
print(24 + 4*(age - 2));
}
if (!(age == int)){ // this here should say that "if the variable age is not an integer"
} else {
print("Invalid age!");
}
}
I have not learned yet how to express “if a variable does not hold an integer”
Thank you in advance
New contributor
someperson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.