Welcome !
         

 Display multiple arrays with WScript.Echo

Author Message
JuanManuel_RdR

  • Total Posts : 8
  • Scores: 0
  • Reward points : 0
  • Joined: 12/5/2015
  • Status: offline
Display multiple arrays with WScript.Echo Sunday, December 18, 2016 8:35 AM (permalink)
0
Hello, I'm learning VBScript. I am learning about the Array function, but I have a litlle problem. Really the problem is displaying multiple elements of the array with WScript.Echo
The example is this:
Option Explicit
Dim JuanMa
JuanMa=Array("Mi","numero","es","4")
WScript.Echo JuanMa(0)

This work, but I don't know how to put, for example, the array 0, 1, and 2 in the same WScript.Echo.
Can somebody help me?
Thanks.
 
 
#1
    59cobalt

    • Total Posts : 2632
    • Scores: 253
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:Display multiple arrays with WScript.Echo Sunday, December 18, 2016 11:30 AM (permalink)
    0
    Concatenate the values:
    WScript.Echo JuanMa(0) & vbNewLine & JuanMa(1) & vbNewLine & JuanMa(2)
    If you want all array elements in the output you can also join them:
    WScript.Echo Join(JuanMa, vbNewLine)

     
    #2
      JuanManuel_RdR

      • Total Posts : 8
      • Scores: 0
      • Reward points : 0
      • Joined: 12/5/2015
      • Status: offline
      Re:Display multiple arrays with WScript.Echo Sunday, December 18, 2016 12:25 PM (permalink)
      0
      Thanks, I had seen it, but I thought that had one more short solution.
      Thanks too for the Join funtion suggestion.
      Regards.
       
      #3
        59cobalt

        • Total Posts : 2632
        • Scores: 253
        • Reward points : 0
        • Joined: 7/17/2011
        • Status: offline
        Re:Display multiple arrays with WScript.Echo Sunday, December 18, 2016 10:14 PM (permalink)
        0
        You're welcome.
         
        #4
          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2017 ASPPlayground.NET Forum Version 3.9