Ruby warning: string literal in condition -
in seventh line, warning, "string literal in condition". warning mean, , how can resolve it?
print 'continue use calculator? y or n' useragree = gets.chomp if useragree == 'y' or 'y' useragree = true else useragree = false end
change
if useragree == 'y' or 'y' to
if useragree == 'y' or useragree == 'y' or, cleaner , clearer in opinion:
if useragree.upcase() == 'y'
Comments
Post a Comment