zoukankan      html  css  js  c++  java
  • Ruby intro

    1. input

    print "What's your first name?"
    first_name = gets.chomp

      chomp will delete " " from the string

    http://www.ruby-doc.org/docs/Tutorial/part_02/user_input.html

    2. output

    with format #{variable_name}

    first_name = "Kevin"
    puts "Your name is #{first_name}!"
    city = gets.chomp  
    puts "The city is " + city  

    3. exclaimation mark !

      make value contain in the variable itself

    state.upcase!

    same as

    state=state.upcase
  • 相关阅读:
    ACM TJU 1556
    HDU 1890 Robotie Sort
    Android学习笔记
    HDU 2795
    HDU 1542
    HDU 1698
    POJ 2185
    学习笔记
    HDU 3336
    HDU 3746
  • 原文地址:https://www.cnblogs.com/phoenix13suns/p/4100956.html
Copyright © 2011-2022 走看看