<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Single Line Array Write</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4d3ca89435/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4d3ca89435/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/4d3ca89435/</id><updated>2020-07-24T18:07:45.602000Z</updated><subtitle>Recent posts to Single Line Array Write</subtitle><entry><title>Single Line Array Write</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4d3ca89435/?limit=25#d59d" rel="alternate"/><published>2020-07-24T18:07:45.602000Z</published><updated>2020-07-24T18:07:45.602000Z</updated><author><name>Morberis</name><uri>https://forge.codesys.com/u/morberis/</uri></author><id>https://forge.codesys.com07772c8e4694b59fdce493c2923936598db38019</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, the number at the start indicates the address in the array that is being filled. Also there is a difference between ' and " where ' is for a string and " is for a wstring.&lt;/p&gt;
&lt;p&gt;arrIndicatorColor : ARRAY&lt;span&gt;[1..5]&lt;/span&gt; OF STRING:= &lt;span&gt;[1('Red'), 2('Yellow'), 3('Green'), 4('Blue'), 5('White')]&lt;/span&gt;;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Single Line Array Write</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4d3ca89435/?limit=25#e554" rel="alternate"/><published>2020-07-24T15:57:26.849000Z</published><updated>2020-07-24T15:57:26.849000Z</updated><author><name>jeremyshubert</name><uri>https://forge.codesys.com/u/jeremyshubert/</uri></author><id>https://forge.codesys.com736de165a5edb94fdb97c09d37b96678e4f59635</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I can easily to the following:&lt;br/&gt;
VAR&lt;br/&gt;
 arrIndicatorColor : ARRAY&lt;span&gt;[1..5]&lt;/span&gt; OF STRING;&lt;br/&gt;
 iColors : INT;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;CASE iColors OF&lt;br/&gt;
  1: &lt;br/&gt;
      arrIndicatorColor&lt;a class="alink" href="/forge/talk-ru/1/"&gt;[1]&lt;/a&gt; := "Red";&lt;br/&gt;
      arrIndicatorColor&lt;a class="alink" href="/forge/talk-ru/2/"&gt;[2]&lt;/a&gt; := "Yellow";&lt;br/&gt;
      .&lt;br/&gt;
      .&lt;br/&gt;
      .&lt;br/&gt;
      arrIndicatorColor&lt;a class="alink" href="/forge/talk-ru/5/"&gt;[5]&lt;/a&gt; := "White";&lt;br/&gt;
END_CASE &lt;/p&gt;
&lt;p&gt;This is a challenge, I'd prefer to set all the values with a single line.&lt;br/&gt;
ex:&lt;br/&gt;
arrIndicatorColor := &lt;span&gt;["Red","Yellow","Green","Blue","White"]&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;However this line of code gives me an error "Unexpected array initialization".  Is there a proper syntax?  I can copy and paste, in my example it's only 5 array elements but if this was 10 elements with 10 cases, it becomes a lot of lines of code.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>