Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Have a loop counter factory giving back a loop counter value object then create a loop counter value changed event handler on the loop counter then send an event
-
System.out.println(0);
System.out.println(1);
System.out.println(2);
System.out.println(3);
System.out.println(4);
System.out.println(5);
System.out.println(6);
System.out.println(7);
System.out.println(8);
System.out.println(9); -
I thought you were serious for a moment... I was about to say what the hell is wrong with you lol.
-
lotd77757y@ilikeglue that sounds just like a Java only thing ;D
Overcomplicating simple stuff for the sake of abstraction -
lotd77757yI was gonna say you can while loop with goto statement.
But goto doesn't exist in Java.. -
int i=10;
while(true){
try{
//code here
int j = 1/--i;
}catch(Throwable t){
//end of loop
}
} -
Wack61917yint i = 0;
for (;;) {
i = i + 1;
if (i <= 10) {
//Do stuff
} else {
break;
}
}
How about this? Note that the i++ is at the beginning, because who needs 0 indexed stuff, duh! (I would bever say that, but hey you asked for the worst we can think of...) -
Worst thing I've seen, C++:
int i; int stop = 0;
for ( ; stop != 1; i++ ) {
// some code...
stop = (condition) ? 1 : 0;
}
Oh and 'i' wasn't actually used. -
//my mind gave birth this senseless abortion
bool success = repeat(10, new Callable<void>() {
public Integer call() {
System.out.println("repeating this");
});
boolean repeat(int times, Callable<T> func) {
return! repeat(0, times, func);
}
int repeat(int i, times, Callable<T> func) {
func.call();
return i < times ? repeat(++i, times, func) : 0;
} -
switch(true) {
case $a > $b:
...
case $c == "hello":
...
...
sponsored by the PHPepsi community
Related Rants
GUYS WE HAVE BEEN WRITING FOR LOOPS IN JAVA WRONG THE WHOLE TIME. Here is how it should be done correctly...
int i = 0;
for(;(i<10) ? true : false;)
{
i++;
System.out.println(i);
}
Jokes aside though does anyone have any more horrid ways to write this?
rant
for loop
loop
for
test answer
joke
java
bad
disgusting
ugly