#1927 list/array

fantlan Tue 26 Jun 2012

how can write an array with dynamic size? and how can i write an array of fixed size of 200? thxx

fantlan Tue 26 Jun 2012

and the array i want it to contain strings...

fantlan Tue 26 Jun 2012

these are the things i tried but non of them works:

kind := Str[,].fill("", 100) kind1 := Str?[,] Str[] name:=new Str[100];

error it gives me: "type inference not supported for fields"

anyone knows what is the problem???

fantlan Tue 26 Jun 2012

sorry for posting so much... i found out that if i write it inside a function there is no error but inside a class yes.. i want it to be a field of an object so i put it inside a class... but it seems like we cant??

s what i want to do in my code: class hello{

a := Str[,].fill("", 100)

b := Str[,].fill("", 100)
c:= Int[,].fill(0, 100)
d:= Str[,].fill("",100)

} class howareyou{ hello h1:=hello{} hello h2:=hello{} function1 . . h1.a[0]:=.... . function2 . h2.c[1]:=.... . etc }

ANY IDEAS??

KevinKelley Tue 26 Jun 2012

You need

Str[] a := ...

in other words you need to declare the type of the field a, rather than the compiler inferring it, when a is a member of a class, rather than a local variable.

Login or Signup to reply.