From: Gavin Sinclair Date: 2002-12-02T18:41:23+09:00 Subject: Re: [FAQ] [Revised again] What are the non-alphanumerical symbols in Ruby code? From: "Martin DeMello" > Gavin Sinclair wrote: > > ~ << >> & ^ | > > [...] > > > 4. "<<" is also the operator for appending to an array/string in place > a = [1,2,3] > a += [4,5] # Creates a new array object and assigns it to a > a << [4,5] # appends [4,5] directly to the array object a points > # to > > (personally, I use that even more than I do here documents) Thanks Martin. I've rearranged that section as well. It now reads <> & ^ | Binary (bitwise) operators. "~" returns the bitwise complement of the value (~2 is -3); "<<" and ">>" shift the bits of the value left and right by the specified number of bits (2 << 2 is 8 >> 2). "&", "^", and "|" are bitwise "and" and exclusive and regular "or" operators. << 1. Appends an Array or String in place. a = [1,2,3] a << 4 # a == [1,2,3,4] 2. A "here" document follows, e.g.: puts < 99 ?" # -> 34 @ @@ @var is an instance variable and @@var is a class variable. EOF Gavin