[Vala] Concatenating strings..



Hey All -- I'm new to vala and while I've wanted to learn C, I just haven't had a need for it. I'm an Oracle 
DBA and perl+dbi suites me very well. But, alas, I want to take the plunge and would like to write some gnome 
applications. I've come quite accustomed to writing OO-Perl and I had been looking at C# because the syntax 
looked very logical to me. But then I ran into vala and gotta say, this is the direction I see myself going 
for two reasons.. Again, the syntax looks logical and in the end, it generates C so I'll get more fimiliar 
with that as well. Best of both worlds. 8D

That being said.. I'm sure I will have a ton of obvious questions... such as, string concatenation.. I'm 
trying this:

public class SMF : GLib.Object {

  private const string FOO  = "foo";
  private const string BAR  = "bar";
  private const string BAZ  = FOO + BAR;

  public static int main () {
 
    message(BAZ);

    return 0;
  }
}

And you'll probably guess that my error is:

  error: invalid operands to binary +

And if I try:

  private const string BAZ  = "%s %s".printf(FOO, BAR);

I get:

  error: initializer element is not constant

So.. would someone be so kind as to tell me how this is done? I would appreciate it!

Thx
SMF 8D






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



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