zoukankan      html  css  js  c++  java
  • LRTHW笔记六

    源码ex6-2.rb

    types_of_people = 10
    x = "There are #{types_of_people} types of people."    
    binary = "binary"
    do_not = "don't"
    y = "Those who know '#{binary}' and those who #{do_not}."
    z = 'Those who know "#{binary}" and those who #{do_not}.'
    puts x
    puts y
    
    puts "I said: #{x}"
    puts "I also said: '#{y}'."
    puts "I also said: '#{z}'."

    结果是:

    [ufindme@ufindme rubywork]$ ruby  ex6-2.rb 
    There are 10 types of people.
    Those who know 'binary' and those who don't.
    I said: There are 10 types of people.
    I also said: 'Those who know 'binary' and those who don't.'.
    I also said: 'Those who know "#{binary}" and those who #{do_not}.'.

    这里注意一点:

      双引号里面的单引号是原样输出,而单引号里面的双引号也是原样输出。

      双引号里面的变量的输出时,变量用实际的值代替后输出显示。

      单引号是不管引号里面的是什么,都源码输出,也没有替代。

  • 相关阅读:
    hdu5289 RMQ+二分
    poj1459 最大流Dinic
    poj2391 最大流+拆点
    poj1087&&hdu1526 最大流
    NOI2004 郁闷的出纳员
    Treap入门(转自NOCOW)
    poj 2892
    vijos 1512
    对拍程序
    poj 3264
  • 原文地址:https://www.cnblogs.com/ufindme/p/3949530.html
Copyright © 2011-2022 走看看