Counter: 519, today: 1, yesterday: 0



とりあえず存在確認w

hinata-mitsurus-imac-2:~ mitsuruhinata$ which ruby
/usr/bin/ruby
hinata-mitsurus-imac-2:~ mitsuruhinata$ which perl
/usr/bin/perl
hinata-mitsurus-imac-2:~ mitsuruhinata$ which python
/usr/bin/python
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Thu Aug 20 19:43:26 JST 2009

お!

hinata-mitsurus-imac-2:~ mitsuruhinata$ which rails
/usr/bin/rails
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Thu Aug 20 20:48:20 JST 2009

お!

hinata-mitsurus-imac-2:~ mitsuruhinata$ which irb
/usr/bin/irb
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Thu Aug 20 20:55:05 JST 2009

1日目2時限目

hinata-mitsurus-imac-2:~ mitsuruhinata$ irb

exit
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Fri Aug 21 04:08:00 JST 2009
hinata-mitsurus-imac-2:~ mitsuruhinata$ irb

print "hello world!\n"
hello world!
=> nil

print "aaa\n", "bbb\n" , "ccc\n"
aaa
bbb
ccc
=> nil

1+2+3+4+5
=> 15

one=1
=> 1

two=2
=> 2

one+two
=> 3

one*two
=> 2

if true

print "hello\n"

end
hello
=> nil

if one==1

print "hello\n"

end
hello
=> nil

if one==2

print "hello\n"

end
=> nil

exit
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Fri Aug 21 04:18:14 JST 2009

練習問題

Fri Aug 21 04:18:14 JST 2009
hinata-mitsurus-imac-2:~ mitsuruhinata$ irb

10^100
=> 110

10**100
=> 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

10**100-1
=> 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

0.5==1/2
=> false

0.5==1/2.0
=> true

1.6===2.3
=> false

1.6===2
=> false

1.6===Numeric
=> false

1.6===2.3.class
=> false

"1.6"===Numeric
=> false

"1.6"===aaa
NameError: undefined local variable or method `aaa' for main:Object

	from (irb):11

"1.6"==="aaa"
=> false

"1.6"===String
=> false

"1.6".class
=> String

"aaa".calss"

"
NoMethodError: undefined method `calss' for "aaa":String

	from (irb):15

"aaa".calss
NoMethodError: undefined method `calss' for "aaa":String

	from (irb):18

"aaa".class
=> String

"1.6".class===String
=> false


?>
?>
?>
?> aaa
NameError: undefined local variable or method `aaa' for main:Object

	from (irb):25

if 10 / 3 == 3

1

else
?> 2

end
=> 1

exit
hinata-mitsurus-imac-2:~ mitsuruhinata$ #kaitoumo kakunin
hinata-mitsurus-imac-2:~ mitsuruhinata$ #7 ha atteta
hinata-mitsurus-imac-2:~ mitsuruhinata$ date
Fri Aug 21 04:43:57 JST 2009

回答
http://www.shoeisha.com/book/hp/10days/down/index.html#9784798114729


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-04-10 (土) 19:17:55 (2686d)