Variable _ and multiple assignment in irb

e$B1sF#PR2p$H?=$7$^$9!#e(B

irb e$B$Ge(B _ e$B$KB?=EBeF~$r$9$k$H$J$s$+JQ$J5$$,$7$^$9!#e(B

$ irb -v
irb 0.9.5(05/04/13)
$ irb
irb(main):001:0> x,=[1,2]
=> [1, 2]
irb(main):002:0> x
=> 1
irb(main):003:0> _,=[1,2]
=> [1, 2]
irb(main):004:0> _
=> [1, 2]

ruby e$BK\BN$G$Oe(B _ e$B$be(B 1 e$B$K$J$k$N$G!"$*$=$i$/e(B irb
[email protected]$H;W$$$^$9!#e(B
irb e$B$G$b0l9T$G=q$/$He(B 1 e$B$K$J$j$^$9!#e(B

irb(main):005:0> ,=[1,2];
=> 1

irb 0.9(02/07/03) e$B$G$O:F8=$7$^$;$s$G$7$?!#e(B
e$B<B32$O3’[email protected]$H;W$$$^$9$,!"0l1~Js9pCW$7$^$9!#e(B

e$B$o$?$J$Y$G$9!#e(B

irbe$B$G$Oe(B_e$B$O:G8e$K<B9T$7$?7k2L$rJ];}$7$F$$$^$9!#e(B

% irb

“foo”
=> “foo”

_
=> “foo”

“Yusuke ENDOH” [email protected] writes:

=> [1, 2]
irb(main):004:0> _
=> [1, 2]

ruby e$BK\BN$G$Oe(B _ e$B$be(B 1 e$B$K$J$k$N$G!"$*$=$i$/e(B irb [email protected]$H;W$$$^$9!#e(B

_,=[1,2]e$B$N<B9T7k2L$Oe(B[1, 2]e$B$J$N$Ge(B_e$B$Oe(B[1,
2]e$B$K$J$j$^$9!#e(B

irb e$B$G$b0l9T$G=q$/$He(B 1 e$B$K$J$j$^$9!#e(B

irb(main):005:0> ,=[1,2];
=> 1

e$BESCf$G;H$o$l$?e(B_e$B$NCf?H$,<B9T7k2L$K$J$k$N$Ge(B1e$B$H$J$j$^$9!#e(B

irb 0.9(02/07/03) e$B$G$O:F8=$7$^$;$s$G$7$?!#e(B

[email protected]$H;W$$$^$9!#e(B

doc/irb/irb.rd.jae$B$h$jH4?he(B:

= e$B%7%9%F%`JQ?te(B

— _
e$BA0$N7W;;$N<B9T7k2L$r3P$($F$$$ke(B(e$B%m!<%+%kJQ?te(B).
— __
e$B<B9T7k2L$NMzNr$r3P$($F$$$ke(B.
__[line_no]e$B$G!"$=$N9T$G<[email protected]$k$3$H$,$G$-$ke(B.
line_noe$B$,Ii$Ne(B
e$B;~$K$O!":G?7$N7k2L$+$ie([email protected]$k$3$H$,$G$-$ke(B.

e$B1sF#$G$9!#e(B

e$B0U?^$5$l$?5sF0$G$7$?$+!#e(B
e$B<:Ni$7$^$7$?!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs