Ruby_day [1] control flow 2

Source: Internet
Author: User

Summary:

1: puts "s in # {user_input}" is different from puts's in # {user_input} '. The former # {user_input} outputs the user_input value, the latter only outputs the token as is, s in # {user_input}

1 print "thtring, pleathe! : "2 user_input = gets. Chomp 3 user_input.downcase! 4 5 If user_input.include? "S" 6 user_input.gsub! (/S/, "th") 7 else 8 puts "nothing to do here! "9 end10 11 puts" your string is: # {user_input }"

 

(As a general rule, Ruby methods that end?Evaluate to the Boolean valuesTrueOrFalse.

Ruby_day [1] control flow 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.