Multiple fields in one line

410 views Asked by At

Is there any way to declare two (or more) field in the same line?

When i try:

public class Test : Object{
    private int i,j;
    public static int main(string[] args){
        stdout.printf("test\n");
        return 0;
    }
}

And compile with valac Test.vala I get this error:

Test.vala:2.2-2.8: error: syntax error, expected declaration
    private int i,j;
    ^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
1

There are 1 answers

3
apmasell On BEST ANSWER

Each one needs a separate declaration. Sorry, lots of typing. Although, private is implied, so you don't strictly need it.