if(true == true){
System.out.println("true")
}
//vs.
if(true == true)
{
System.out.println("true")
}
Discuss.
if(true == true){
System.out.println("true")
}
//vs.
if(true == true)
{
System.out.println("true")
}
Discuss.
No. We are not falling for your bait op.
Latter in C/C++. Former in everything else.
For a single statement you don't use brackets.
You put it all on the same line too.
inb4 python
This thread has been made a million times already, FUCK OFF.
Go find some other way to piss people off.
if(x==y){ System.out.println("true") }
desu
first time I've seen one. I'm with the second one OP
if (x==y) System.out.println("true")
if(true)
System.out.println("true");
How?? How is this the first time you've seen this thread? It happens all the fucking time. Every day somebody makes this thread.
if(true==true) {system.out.println("true");
}
puts "true" if true
you serious?
if(x==y) System.out.println("true");
There is a master race. Look upon it, now.
Don't be like apple, boys. Don't use gotos or this method of boolean evaluation.
...
I honestly thought it was Python when I first glanced at it
> if(true == true)
Designated Indian code.
if (true == true)
goto fail;
goto fail;
And if someone inherits your code it's that much more difficult to sort out...
i'm in love w/ u
Not OOP enough.
package thruthy;
class TruthValue implements Comparable {
private boolean val;
public TruthValue(boolean val) {
this.val = val;
}
public truthValue() {
truthValue(false);
}
public boolean getValue() {
return this.val;
}
public void setValue(boolean val) {
this.val = val;
}
@Override
public int compareTo(TruthValue otherVal) {
if (otherVal == Null) {
throw new NullPointerException("You must not compare to Null because reasons.");
};
if (otherVal.getValue() == this.getValue()) {
return true;
} else {
return false;
}
}
}
class Main{
public static void main(String args[]){
TruthValue val1 = new TruthValue(true);
TruthValue val2 = new TruthValue(true);
if (val1.compareTo(val2)) {
System.out.println("true");
}
}
}
Good job, posting the thumbnail.
public class Program
{
public static void main(String[] args)
{
int x = 6;
if (x >= 5) {
System.out.println("true");
}
else {
System.out.println("false");
}
}
}
bool GetTrue(bool trueval) {
return trueval != false;
}
if(1 && true && !false && GetTrue(true)) {
System.out.println("very true");
}
>not using decent editor
>being bad programmer
no it doesn't. first for me too.
As long as the code is run through an auto-formatter so that it's the same everywhere I don't care.
>
>you serious?
>if(x==y) System.out.println("true");
This
You're a decent human being user
my coworkers use:
if(true)
{
system.out.println
}
its unreadable
Thats genius! Love it! I'm sure $coworkers will thank you for the now beutified code base
void main(int number){
if(number == 0){
printf("0");
}
if(number == 1){
printf("1");
}
if(number == 2){
printf("2");
}
if(number == 3){
printf("3");
}
if(number == 4){
printf("4");
}
if(number == 5){
printf("5");
}
if(number == 6){
printf("0");
}
if(number == 7){
printf("7");
}
if(number == 8){
printf("8");
}
if(number == 9){
printf("9");
}
if(number == 10){
printf("10");
}
v
if(number == 11){
printf("11");
}
if(number == 12){
printf("12");
}
if(number == 13){
printf("13");
}
if(number == 14){
printf("14");
}
if(number == 15){
printf("15");
}
if(number == 16){
printf("16");
}
if(number == 17){
printf("17");
}
if(number == 18){
printf("18");
}
if(number == 19){
printf("19");
}
if(number == 20){
printf("20");
}
else {
printf("Please enter smaller numbers");
}
}
It only works for small numbers.
...
if(number == 0){
printf("0");
} if(number == 1){
printf("1");
} if(number == 2){
printf("2");
...
This is only logical way
But by putting declarations in front of ending brackets can stress the compiler and generate a stack overflow.
Latter in C#, former in anything else
The hell did you read that from?
It's true. There are other things. If after a declaration you put a space between the end of the declaration and the ; it causes a infinite loop.
int var ;
What happens here is that the compiler is stuck at the space character trying to read the semi-colon, and since it never read it, it's stuck.
Neither, both are syntactically invalid.
>System.out.println
this is the only way
void function test(int argument)
{
if (!argument)
doThis();
else
doThat();
if (otherCondition()) {
doThisAswell();
DoThisNotAswell();
} else {
dontDoThis();
}
}
if(1)
printf("true")
>no space outside parentheses
Reported.
if(true) System.out.println("true");
System.out.println("true")
>compareTo
Shouldn't you be overriding equals, instead of compareTo in that case?
In this case I would use:
switch( number )
{
case 1: printf("1"); break;
case 2: printf("2"); break;
...
case 20: printf("20") break;
default: printf("Please enter smaller numbers"); break;
}