Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:45:56+00:00 2026-06-17T14:45:56+00:00

I figured the array out, but now I want to Write-host the value of

  • 0

I figured the array out, but now I want to Write-host the value of my $CreateGrid[1,1] for example to

Write-host "  A   B   C   D   E   F   G   H   I   J " 
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 1"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 2"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 3"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 4"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 5"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 6"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 7"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 8"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "|   |   |   |   |   |   |   |   |   |   | 9"
Write-host "+---+---+---+---+---+---+---+---+---+---+ "
Write-host "| $CreateGrid[1,1] |   |   |   |   |   |   |   |   |   | 10"
Write-host "+---+---+---+---+---+---+---+---+---+---+ " 

However when I try this, I get the following output for the value:

(          System.Object[] System.Object[] System.Object[] System.Object[] System.Object[] System.Object[] System.Object[] System.Object[]             Syst
em.Object[] System.Object[]                   System.Object[]                                                 [1,1])

How would I go around this? or is there a more clever way?
In short I want to include the positional value of the array in the Grid shown above.

EDIT:

$CreateBoard = New-object "Array[,]" 10,10

Function Add-ToColumn{
param ([Int] $columnnum,[String] $player)

    PROCESS{if (0..9 -notcontains $columnnum){"Invalid move";return}
        #0 is the bottom, 9 is the top
        for($i = 0; $i -le 9; $i++)
        {
            if ($CreateBoard[$columnnum, $i] -eq $null)
            {
                $CreateBoard[$columnnum, $i] = $player
                "Coin placed in $columnnum, $i coins in the column!"
                return
            }
        }
        #if you get here, column is full
        "Invalid move"
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:45:57+00:00Added an answer on June 17, 2026 at 2:45 pm

    When you put an expression in a double quoted string, the parser stops at the first non-variable name character. So:

    "$CreateGrid[1,1]"
    

    is processed as if it were

    "$CreateGrid" + "[1,1]"
    

    and as $CreateGrid is (or at least appears to be) an array it performs a ToString on each member and concatenates the results (as this is a two dimensional array, each enumerated member is an array, hence System.Object[] multiple times).

    If you use the expression syntax ($(...)) inside the string the whole contained expression is processed as a PowerShell expression (eg. you can put a pipeline in there):

    "$($CreateGrid[1,1])"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I just now figured out how to sort a 2d array via
this has been bugging me for ages now but i can't figure it out..
I know there are quite a few text-to-array questions out there, but I am
I cannot figure out how to set an array to one of two sets
I'm trying to figure out a way to take a Ruby array and create
Is there a way to figure out where in an array a pointer is?
I have a character array and I'm trying to figure out if it matches
I want to parse a SQL query into an array. I could not figure
I figured out how to clone my form rows and append an incriminting number
I'm really sorry. This must seem like an incredibly stupid question, but unless I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.