[Vala] [vala][genie] Problems with length



Hello,

I am trying to get familiar with genie. Compiling the following code is not possible:

[indent=2]
init
  var a = new array of int = {1, 2, 3, 4, 5, 6, 7, 8}
  for s in a do print(s)
  print a.length

  var b = "Hello World"
  print b.length

I get the following errors:

klaus LittlX:~/src/vala$ valac-0.14 example2.gs
example2.gs:4.23-4.23: error: Arithmetic operation not supported for types `int' and `string'
  for s in a do print(s)
                      ^
example2.gs:5.9-5.16: error: Arithmetic operation not supported for types `int' and `string'
  print a.length
        ^^^^^^^^
example2.gs:8.9-8.16: error: Arithmetic operation not supported for types `int' and `string'
  print b.length
        ^^^^^^^^
Compilation failed: 3 error(s), 0 warning(s)

I really can't imagine what's wrong. Or can't I use the .length operator in that way? What else should I use instead? valac is 0.14.2.

-Klaus

--
 Klaus Rotter * klaus at rotters dot de * www.rotters.de



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]