ruby基础学习一
上一篇 /
下一篇 2012-12-14 13:09:30
/ 个人分类:程序设计
puts "#{x} + #{y} = #{x + y}"
puts x.to_s+" + "+y.to_s+" = "+(x+y).to_s
puts "it's a #{"bad " *5}world"
puts "footes".sub('foo','tes')
puts "txllo".sub(/^../,'he')
puts "heltx".sub(/..$/,'lo')
"123f5".scan(/./){|letter|puts letter}
"this is a test".scan(/\w\w/){|x| puts x}
"this is $1000 is $10 multiply 100".scan(/\d+/) do |x|
puts "hello tom.this is.jake alny".split(/\./).inspect
type = x <18 ? "child":"adult"
1.upto(100){|jumper| sum +=jumper}
require 'watir-webdriver'
b = Watir::Browser.new :firefox,:profile => 'default'
b.text_field(:id =>'kw').set 'selenium'
b.button(:id => 'su').click
收藏
举报
TAG:
Ruby
ruby
Watir
watir
注释