Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Ternary Operator

Name: Anonymous 2010-01-08 8:07

ALL HAIL!

Name: Kao-Moji 2010-01-09 18:09

public final int luckySum(final int a,final int b,final int c) {
 return a == 13 ? 0 : b == 13 ? a : c == 13 ? a + b : a + b + c;
}


public final int intMax(final int a, final int b,final int c) {
 return a > b ? a > c ? a : c : b > c ? b : c;
}


public final int max1020(int a,int b) {
 if (b > a) { b ^= a; a ^= b; b ^= a; }
 return inRange(a) ? a : inRange(b) ? b : 0;
}

private final boolean inRange(final int n) {
 return n >= 10 && n <= 20;
}


public final String endUp(final String str) {
  int bounds = str.length() - 3;
  return str.length() < 4 ? str.toUpperCase() : str.substring(0,bounds) + str.substring(bounds).toUpperCase();
}


public final int caughtSpeeding(int speed, final boolean isBirthday) {
 if (isBirthday) speed -= 5;
 return speed <= 60 ? 0 : speed >= 61 && speed <= 80 ? 1 : 2;
}


public final int dateFashion(final int you, final int date) {
 return you <= 2 || date <= 2 ? 0 : you >= 8 || date >= 8 ? 2 : 1;
}

Name: Anonymous 2010-01-09 21:45

>>40,41
If you indented those in the right way, they look almost like Lisp without the parens.

Name: Anonymous 2010-01-10 0:38

>>42
Lisp without the parens.
You mean we've finally fixed Lisp?

Name: Anonymous 2010-01-10 0:57

final final final final final final final final final final final final public final public public final public final final final final final final public final final final final final final final final final final final final final public final public public final public final final final final final final public final final final final final final final final final final final final final public final public public final public  final final public final final final final final final final final final final final final final public final public

Name: Anonymous 2010-01-10 1:08

>>44
final define final fib x public
  final if final < x 1 public
    1
    final + final fib final - x 1 public public final fib final - x 2 public public public public public

Name: Anonymous 2010-01-10 1:24

final is the single worst thing in Java if everything else is rendered "tolerable."

Name: Anonymous 2010-01-10 2:21

http://www.ibm.com/developerworks/java/library/j-jtp1029.html

And why does every buio enterprise /buio compsci website have to look like this? haven't they ever heard of leading? i want to gouge my eyes out

Name: Anonymous 2010-01-10 2:43

>>47
BUIO QUALITY

Name: Anonymous 2010-01-12 6:00

IF THEN ELSE.

Name: Anonymous 2010-01-12 9:51

I strongly prefer "boiu" because it sounds good in my head.

Name: Anonymous 2010-01-12 12:06

>>47
Performance enhancement is almost always a bad reason to compromise good object-oriented design principles
This is what ENTERPRISE programmers believe.

Also,

buio m (f buia, m plural bui, f plural buie)

1. dark (contrary of luminous)

Name: Anonymous 2010-01-12 12:27

Dark like Edward???

Name: Anonymous 2010-01-12 12:42

>>50
I prefer \\ buio// because it sounds like a spell from the Harry Potter series of books and film

Name: Anonymous 2010-01-12 12:58

Everyone knows ``boui'' is the standard.

Name: Anonymous 2010-01-12 13:08

This is ridiculous.  ´´biuo`` is the only sensible scheme.

Name: Anonymous 2010-01-12 15:01

Obviously only 66buoi99 represents BEST PRACTICES.

Name: Anonymous 2010-01-12 15:13

Fags don't know how to use [biou].

Name: Anonymous 2010-01-12 16:11

I am ashamed and appalled, /prog/, that you would be getting your information from anywhere other than the the source. Read your BB&C. The standard is ubio.

Name: Anonymous 2010-01-12 16:14

I prefer ❝uibo

Name: Anonymous 2010-01-12 16:39

>>59
I ❝lol'd❞

Name: Anonymous 2010-01-14 11:13

Sometimes it is but sometimes the ternary operator can cost you a temporary variable or causes strange conversions.

Not JAVA.

Name: Anonymous 2010-03-21 23:28

all the solutions are online.

Name: Anonymous 2010-03-22 16:01

It should technically be obui, as no respectable HTML programmer would put a span inside a formatting tag, also b is always the first for some reason. But buio is fun to say in your head and is easiest to type on a AZERTY keyboard.

Name: Anonymous 2010-03-22 16:19

>>63
Actually, the obui and buio standards are incompatible, as you can see. For a truly enterprise format, even the strictest HTML Programmer has but no choice!

Name: Anonymous 2010-03-22 17:52

>>64
Oh, of course! Silly me. But it is still strange how the u and o parts are not italicised by i, isn't it! Observe the parallelity of the lines in the following:
biuo
buoi
Astounding!!!

Name: Anonymous 2010-03-23 1:43

>>63
ブイオ

Name: Anonymous 2010-03-23 2:21

You are now realizing that ternary sounds like turnkey.

Name: Anonymous 2010-03-23 5:01

>>67
ENTERPRISE TERNARY SOLUTIONS

Name: Anonymous 2010-03-23 5:11

In fact, the level of 1337ness is proportional to amount of ternary operators per 1Kb of code.

Name: Anonymous 2010-03-23 5:13

>>69
Mine is 0.5 ternaries per Kb ;_;

Name: Anonymous 2010-03-23 5:42

>>69
I have two in one 47 line function!

Name: Anonymous 2010-04-20 14:59

predicate && true_expr || false_expr

Name: Anonymous 2010-04-20 15:18

>>72
split-p soup?

Name: Anonymous 2010-04-20 16:56

>>72
Invalid Boolean Expression.

Name: Anonymous 2010-04-20 17:36

>>74
Since when? It works for me.

Name: Anonymous 2010-04-20 17:43

>>75
Logical AND and Logical OR have the same precedence in Boolean Logic, therefore that statement is technically invalid.

Name: Anonymous 2010-04-20 19:41

>>76
Fully depends on what langauge you're using

Name: Anonymous 2010-04-21 3:59

Ternary is great until you reach some one-liner made of v:?b?:(3*d)?:c:((f-0.2)/2)?e?d:(c>a)?a

Name: Anonymous 2010-04-21 4:02

>>78
It's great until it's great?

Name: Anonymous 2010-04-21 4:06

>>79
Until?Great:NotGreat

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List