Pull to refresh

Эволюция точки с запятой

Reading time1 min
Views988
На сайте Кея Хорстманна лежит забавное видение эволюции ЯП.

1980: C
printf("%10.2f", x);

1988: C++
cout << setw(10) << setprecision(2) << showpoint << x;

1996: Java
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) {
System.out.print(' ');
}
System.out.print(s);


2004: Java
System.out.printf("%10.2f", x);

2008: Scala and Groovy
printf("%10.2f", x)

(Thanks to Will Iverson for the update. He writes: “Note the lack of semi-colon. Improvement!”)

Обратите внимание на выпадение точки с запятой. ВпечатляетДостижение Прогресс!

Tags:
Hubs:
Total votes 19: ↑16 and ↓3+13
Comments19

Articles