The program given in the example doesn't work. only the last print statement gets printed everytime for every value. help. thank you


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-NFCZ7/3/2?curriculum_id=5059f8619189a5000201fbcb#


 a = 10
 b = 12
if a>b
    print "a is largest!"
elsif b<a
    print "b is largest!"
else
    print "b is equal to a!"
end


#2

Well, only one line gets printed because your code is to make a comparison, which you set, and then tell you, that is, print.

In your code example, b is greater than a. So, it should print the corresponding statement.

Please, reconsider these two.

The logic is of same direction (i.e, both has a > b) and the print statements are not corresponding!


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.