I don't think you can use a symbol in a parameter list ever.

-j

(grid+grid.transpose).map {|x,y,z| x=='X' && x==y && y==z}

As long as you don't want diagonals



YAD wrote:
> Trying to write one function that will find a
> full row or column in a 2D array (for tic-tac-toe).
> Like this:
> 
> ------------------------------------------
> $grid =
>   [[' ',' ','O'],
>    ['X','X','X'],
>    ['O',' ',' ']]
> 
> def doAxis (outr,inr)
>  outerLoop:
>   [0,1,2].each do |:"#{outr}"|
>     [0,1,2].each do |:"#{inr}"|
>       if ($grid[row][col] != 'X')
>       next outerLoop # is this supported?
>       end
>     end
>     puts "Got 3 in a row!"
>     return true
>   end
>   false
> end
> 
> doAxis 'row', 'col' # want to find full rows
> doAxis 'col', 'row' # want to find full columns
> -----------------------------------------------
> 
> Is this possible?  So far Ruby doesn't seem to like it.
> What are the limits to how you can use this construction?
> 
> :"#{foo}"
>