Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
Problem with array constants |
Fri, May 25 2018 3:02 AM | Permanent Link |
Michael Dreher | var
// This compiles... array1 : array of string = ['11', '22']; array2 : array of string = ['11', '2']; array3 : array of string = ['1', '22']; // ...but on this I get a compiler error: array4 : array of string = ['1', '2']; // [Error] Main.wbs (11,30): Expected array of String but instead found Using 2.06B14. Michael Dreher |
Fri, May 25 2018 4:04 AM | Permanent Link |
Matthew Jones | Michael Dreher wrote:
> ['1', '2']; Just a ponder - is it thinking those are both chars? The other examples have more than one character each. -- Matthew Jones |
Fri, May 25 2018 5:08 AM | Permanent Link |
Michael Dreher | "Matthew Jones" wrote:
// Just a ponder - is it thinking those are both chars? The other // examples have more than one character each. That also came to my mind. But chars are assignable to strings. I just did another test, int vs. float: arr1 : array of double = [1.1, 2.2]; // compiles arr2 : array of double = [1, 2]; // [Error] Unit1.wbs (32,28): Expected array of Double but instead found arr3: array of double = [1, 2.2]; // [Error] Unit1.wbs (34,31): Expected integer, variant, or enumeration but instead found 2.2 arr4: array of double = [2.2, 1]; // compiles Seems the order of elements also has an effect. Michael Dreher |
Fri, May 25 2018 10:48 AM | Permanent Link |
Raul Team Elevate | On 5/25/2018 3:02 AM, Michael Dreher wrote:
> array4 : array of string = ['1', '2']; Casting issue. Try array4 : array of string = [String('1'),String('2')]; Raul |
Mon, May 28 2018 2:10 AM | Permanent Link |
Michael Dreher | Raul wrote:
// Casting issue. Try... Thanks for the hint. It seems sufficient to just cast the first array element. M. Dreher |
Tue, May 29 2018 1:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Michael,
<< // [Error] Main.wbs (11,30): Expected array of String but instead found >> I think that Matthew is correct and the compiler thinks that the array elements are characters, not strings. As far assignability is concerned, yes, characters are normally assignable to strings. However, EWB expects arrays to be consistently characters or strings because it reserves the right to optimize these in its runtime so that they are not just big arrays of "variants". I'll have a fix for this in the next build 15. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |