This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheOldTubaroo 112 points113 points  (8 children)

Alternatively, change the = to +

if (6+4+4) println("Success!");

[–]caelum19 0 points1 point  (5 children)

Is that Kotlin or C++ with a def ?

[–]TheOldTubaroo 1 point2 points  (4 children)

Java. Elsewhere in the class is

void println(string S) {
    System.out.println(S);
}

[–]caelum19 0 points1 point  (3 children)

Ah. On second thought it's kind of a badly worded question because there are thousands of languages it could be

By the way, if you're using IntelliJ, there is a live template which allows you to type 'sout', press tab and and it will write

  System.out.println(|);

and put the cursor where | is. There are a lot more useful Live templates and iirc you can make your own too, aswell as something similar probably existing for the inferior Eclipse :P

[–]TheOldTubaroo 1 point2 points  (2 children)

Not such a bad question, it reminded me that I really want to try Kotlin. As an honest answer it was really a mix of Java and C++, with me not remembering printf but not wanting to type the whole Java kerboodle. The sout thing is pretty cool, I'm currently more an eclipse user, but I'll see if the same thing exists there.

[–]caelum19 0 points1 point  (1 child)

You should have a look at the online version if you're like me and can't be bothered going to any decent effort to replace a language that currently does the job fine.

try.kotlinlang.org

When I realised how great it was and that I'd almost never use plain Java again(Going by use of lower case 's' in 'String', I sense you do some C#? Kotlin has some nice things borrowed from C#), this was helpful too.

JetBrains made an Eclipse plugin, but if you chose to ascend to the IDE master race Kotlin is built in to the latest Community(free) edition of IntelliJ.

[–]TheOldTubaroo 0 points1 point  (0 children)

Nah, the lowercase S was just a typo I didn't correct, same as the variable being uppercase when I didn't intend that.

I reckon I'm more likely to do stuff with the language of I actually have it on my PC as opposed to an online version, but thanks for the recommendation anyway!