DEV Community

Elliot Derhay
Elliot Derhay

Posted on

If Statement Golf: what's the longest one you've seen?

Let's play a little game. Who has seen the most ridiculous set of conditions within the parentheses of an if statement?

Trigger Warning šŸ˜”

Before commenting, please know I understand there are developers out there who hate if statements with a passion. If you are such a developer, please stay away to avoid needing heart medication and/or a psychological examination.

Now, getting back to our little game...

The rules šŸ“–

  • Only what's within a single set of outer parentheses of an if statement counts
    • JS example: if ( condition ) {
  • If parentheses aren't required for your language of choice, then everything after the if and before the terminating character counts
    • e.g., BASH if statements wrap individual conditions in sets of parentheses or brackets, so they also count.
    • if [ -r $1 ] && [ -s $1 ]; then
  • You can't count multiple sets of statements from something like an if...elseif...else. In cases like those, only use the set of conditions from a single if or elseif.
  • In this case, I'm not counting multiple parts joined by conditional operators as a single condition. Everything between conditional operators is counted individually.
    • This refers to operators such as and, or, ||, && and any others your language uses.
  • The character count I'm giving is exact because it's in front of me. If you can't pull it up immediately, it's ok to estimate. But please do estimate as close as you can.
One last note šŸ“

Honestly, I'm not sure if I'm using the word "condition" incorrectly here. Should I be using the word "expression" instead? This part of dev grammar is a little fuzzy to me.

With all of that out of the way, let the brain hemorrhaging commence. šŸ˜µšŸ§ 

Top comments (13)

Collapse
 
grmnsort profile image
German Rodriguez Ortiz

I have this "little gem" to share :P

9 conditions and 203 characters long

if ( $hasNoDate || $hasNoDuration || $isPlannedWithoutProgress || $hasNoTask || $isConsolidated || $noTotalTaskWork || $notItemProgressIsOverLimit || $itemProgressIsOverLimit || $targetTaskIsMilestone)

It's used as a validation inside a foreach loop, each statement is a "challenge" that different attributes of the element currently in the loop have to pass, some are a simple bool cast of an atributte, others are longer comparisons or function returns.

It's original format was WAY LONGER :(

Collapse
 
bbasile profile image
Basile B.

Thanks God of Binary Operation for inventing bit sets. I think this expression would clearly be simplified by packet bits here.

Collapse
 
jsn1nj4 profile image
Elliot Derhay

Still at least readable, and using only variables.

Collapse
 
jsn1nj4 profile image
Elliot Derhay

My entry: 18 conditions and 619 characters long.

I'm also including the actual statement, for anyone curious. I've added line breaks in some places to make it somewhat easier to read, but it was originally all on 1 line.

if ($FBtype == 'status' && $FBmessage == '' && $FBstory == ''
  || $FBtype == 'event'
  || $FBtype == 'event' && strpos($FBstory, 'shared their event') !== false
  || $FBtype == 'status' && strpos($FBstory, 'changed the name of the event to') !== false
  || $FBtype == 'status' && strpos($FBstory, 'changed the privacy setting') !== false
  || $FBtype == 'status' && strpos($FBstory, 'an admin of the group') !== false
  || $FBtype == 'status' && strpos($FBstory, 'created the group') !== false
  || $FBtype == 'status' && strpos($FBstory, 'added an event') !== false
  || $FBtype == 'event' && strpos($FBstory, 'added an event') !== false)
Collapse
 
grmnsort profile image
German Rodriguez Ortiz

The first version of my if statement looked very similar to that, until I started to combine some of the comparisons into single variables, made it less intimidating almost instantly :)

Collapse
 
mohr023 profile image
Matheus Mohr

Holy jesus, have mercy on that dev...

Collapse
 
bbasile profile image
Basile B. • Edited

Recently refactored this

else if (ue && customType != tok!"" && ue.unaryExpression && ue.unaryExpression.primaryExpression &&
                ue.unaryExpression.primaryExpression.identifierOrTemplateInstance &&
                ue.unaryExpression.primaryExpression.identifierOrTemplateInstance.identifier == customType &&
                ue.identifierOrTemplateInstance && ue.identifierOrTemplateInstance.identifier.text == "init")

into

else if (const IdentifierOrTemplateInstance iot = safeAccess(ue)
                .unaryExpression.primaryExpression.identifierOrTemplateInstance)

There was not that much conditions but since the ?. operator missed (D language) we had to check nested member against null to reach safely the end of the chain. Now the same is done with metaprograming magic.

Collapse
 
jsn1nj4 profile image
Elliot Derhay • Edited

I have something to admit: my entry isn't actually my code. It's just the code that gave me the idea for this post (although I'll also admit I've written a few bad-looking if statements myself).

I actually posted this because I figured it could possibly be a fun thing to see some crazy if statements (for those of us that aren't outraged by seeing the word if, anyway).

I'll also admit that coming up with writing ideas isn't something I'm terribly good at.

On that last note, thanks for 2 ideas in 1! (posts for motivation, and posts for sharing our own code that we need to learn from)

Edit: In your case, it's nice that you put everything inside of a function. That at least reduces clutter, and the function can be named something meaningful.

Collapse
 
scottishross profile image
Ross Henderson

I don't know if this counts, but this is a multi-nested CASE statement in one of my dynamic SQL queries. CASE acts as a if-then-else statement.

case 
    when LIST_TYPE = 1 
    then 
        case when NEW_TAB = 0 
             then apex_util.prepare_url('f?p=' || 'INSITE' || ':10000:' || :APP_SESSION || '::::P0_MENU_ID:' ||  MENU_ID)
             else 'javascript:apex.navigation.openInNewWindow(' || chr(39) || utl_url.unescape(LINK_TARGET) || chr(39) || ')'
        end
    when LIST_TYPE = 2 
    then 
        case 
            when NEW_TAB = 0 
            then apex_util.prepare_url('f?p=' || APP_ALIAS || ':' || LINK_TARGET || ':' || :APP_SESSION)
            else 'javascript:apex.navigation.openInNewWindow(' || chr(39) || 'f?p=' || APP_ALIAS || ':' || LINK_TARGET || ':' || :APP_SESSION || chr(39) || ')'
        end
    when LIST_TYPE = 3
    then apex_util.prepare_url('f?p=' || 'INSITE' || ':10000:' || :APP_SESSION || ':' || 'APPLICATION_PROCESS=GET_FILE:::P0_MENU_ID:' || MENU_ID)
    else null
end as LINK_TARGET, 
Collapse
 
jsn1nj4 profile image
Elliot Derhay • Edited

I was actually going to see if I could refactor it, but I'm not exactly a SQL pro (see what I did there?)

Thanks for sharing though! Even gave me something new to look at (SQL cases).

Collapse
 
mbksoftware profile image
mbksoftware • Edited

I converted this

if(2 > 1)
if(3 > 2)
if(4 > 3)
if(5 > 4)
if(6 > 5)
if(7 > 6)
if(8 > 7)
if(9 > 8)
if(10 > 9)
if(11 > 10)
if(12 > 11)
if(13 > 12)
if(14 > 13)
if(15 > 14)
if(16 > 15)
if(17 > 16)
if(18 > 17)
if(19 > 18)
if(20 > 19)
if(21 > 20)
if(22 > 21)
if(23 > 22)
if(24 > 23)
if(25 > 24)
if(26 > 25)
if(27 > 26)
if(28 > 27)
if(29 > 28)
if(30 > 29)
if(31 > 30)
if(32 > 31)
if(33 > 32)
if(34 > 33)
if(35 > 34)
if(36 > 35)
if(37 > 36)
if(38 > 37)
if(39 > 38)
if(40 > 39)
if(41 > 40)
if(42 > 41)
if(43 > 42)
if(44 > 43)
if(45 > 44)
if(46 > 45)
if(47 > 46)
if(48 > 47)
if(49 > 48)
if(50 > 49)
if(51 > 50)
if(52 > 51)
if(53 > 52)
if(54 > 53)
if(55 > 54)
if(56 > 55)
if(57 > 56)
if(58 > 57)
if(59 > 58)
if(60 > 59)
if(61 > 60)
if(62 > 61)
if(63 > 62)
if(64 > 63)
if(65 > 64)
if(66 > 65)
if(67 > 66)
if(68 > 67)
if(69 > 68)
if(70 > 69)
if(71 > 70)
if(72 > 71)
if(73 > 72)
if(74 > 73)
if(75 > 74)
if(76 > 75)
if(77 > 76)
if(78 > 77)
if(79 > 78)
if(80 > 79)
if(81 > 80)
if(82 > 81)
if(83 > 82)
if(84 > 83)
if(85 > 84)
if(86 > 85)
if(87 > 86)
if(88 > 87)
if(89 > 88)
if(90 > 89)
if(91 > 90)
if(92 > 91)
if(93 > 92)
if(94 > 93)
if(95 > 94)
if(96 > 95)
if(97 > 96)
if(98 > 97)
if(99 > 98)
if(100 > 99)
if(101 > 100)
if(102 > 101)
if(103 > 102)
if(104 > 103)
if(105 > 104)
if(106 > 105)
if(107 > 106)
if(108 > 107)
if(109 > 108)
if(110 > 109)
if(111 > 110)
if(112 > 111)
if(113 > 112)
if(114 > 113)
if(115 > 114)
if(116 > 115)
if(117 > 116)
if(118 > 117)
if(119 > 118)
if(120 > 119)
if(121 > 120)
if(122 > 121)
if(123 > 122)
if(124 > 123)
if(125 > 124)
if(126 > 125)
if(127 > 126)
if(128 > 127)
if(129 > 128)
if(130 > 129)
if(131 > 130)
if(132 > 131)
if(133 > 132)
if(134 > 133)
if(135 > 134)
if(136 > 135)
if(137 > 136)
if(138 > 137)
if(139 > 138)
if(140 > 139)
if(141 > 140)
if(142 > 141)
if(143 > 142)
if(144 > 143)
if(145 > 144)
if(146 > 145)
if(147 > 146)
if(148 > 147)
if(149 > 148)
if(150 > 149)
if(151 > 150)
if(152 > 151)
if(153 > 152)
if(154 > 153)
if(155 > 154)
if(156 > 155)
if(157 > 156)
if(158 > 157)
if(159 > 158)
if(160 > 159)
if(161 > 160)
if(162 > 161)
if(163 > 162)
if(164 > 163)
if(165 > 164)
if(166 > 165)
if(167 > 166)
if(168 > 167)
if(169 > 168)
if(170 > 169)
if(171 > 170)
if(172 > 171)
if(173 > 172)
if(174 > 173)
if(175 > 174)
if(176 > 175)
if(177 > 176)
if(178 > 177)
if(179 > 178)
if(180 > 179)
if(181 > 180)
if(182 > 181)
if(183 > 182)
if(184 > 183)
if(185 > 184)
if(186 > 185)
if(187 > 186)
if(188 > 187)
if(189 > 188)
if(190 > 189)
if(191 > 190)
if(192 > 191)
if(193 > 192)
if(194 > 193)
if(195 > 194)
if(196 > 195)
if(197 > 196)
if(198 > 197)
if(199 > 198)
if(200 > 199)
if(201 > 200)
if(202 > 201)
if(203 > 202)
if(204 > 203)
if(205 > 204)
if(206 > 205)
if(207 > 206)
if(208 > 207)
if(209 > 208)
if(210 > 209)
if(211 > 210)
if(212 > 211)
if(213 > 212)
if(214 > 213)
if(215 > 214)
if(216 > 215)
if(217 > 216)
if(218 > 217)
if(219 > 218)
if(220 > 219)
if(221 > 220)
if(222 > 221)
if(223 > 222)
if(224 > 223)
if(225 > 224)
if(226 > 225)
if(227 > 226)
if(228 > 227)
if(229 > 228)
if(230 > 229)
if(231 > 230)
if(232 > 231)
if(233 > 232)
if(234 > 233)
if(235 > 234)
if(236 > 235)
if(237 > 236)
if(238 > 237)
if(239 > 238)
if(240 > 239)
if(241 > 240)
if(242 > 241)
if(243 > 242)
if(244 > 243)
if(245 > 244)
if(246 > 245)
if(247 > 246)
if(248 > 247)
if(249 > 248)
if(250 > 249)
if(251 > 250)
if(252 > 251)
if(253 > 252)
if(254 > 253)
if(255 > 254)
if(256 > 255)
if(257 > 256)
if(258 > 257)
if(259 > 258)
if(260 > 259)
if(261 > 260)
if(262 > 261)
if(263 > 262)
if(264 > 263)
if(265 > 264)
if(266 > 265)
if(267 > 266)
if(268 > 267)
if(269 > 268)
if(270 > 269)
if(271 > 270)
if(272 > 271)
if(273 > 272)
if(274 > 273)
if(275 > 274)
if(276 > 275)
if(277 > 276)
if(278 > 277)
if(279 > 278)
if(280 > 279)
if(281 > 280)
if(282 > 281)
if(283 > 282)
if(284 > 283)
if(285 > 284)
if(286 > 285)
if(287 > 286)
if(288 > 287)
if(289 > 288)
if(290 > 289)
if(291 > 290)
if(292 > 291)
if(293 > 292)
if(294 > 293)
if(295 > 294)
if(296 > 295)
if(297 > 296)
if(298 > 297)
if(299 > 298)
if(300 > 299)
if(301 > 300)
if(302 > 301)
if(303 > 302)
if(304 > 303)
if(305 > 304)
if(306 > 305)
if(307 > 306)
if(308 > 307)
if(309 > 308)
if(310 > 309)
if(311 > 310)
if(312 > 311)
if(313 > 312)
if(314 > 313)
if(315 > 314)
if(316 > 315)
if(317 > 316)
if(318 > 317)
if(319 > 318)
if(320 > 319)
if(321 > 320)
if(322 > 321)
if(323 > 322)
if(324 > 323)
if(325 > 324)
if(326 > 325)
if(327 > 326)
if(328 > 327)
if(329 > 328)
if(330 > 329)
if(331 > 330)
if(332 > 331)
if(333 > 332)
if(334 > 333)
if(335 > 334)
if(336 > 335)
if(337 > 336)
if(338 > 337)
if(339 > 338)
if(340 > 339)
if(341 > 340)
if(342 > 341)
if(343 > 342)
if(344 > 343)
if(345 > 344)
if(346 > 345)
if(347 > 346)
if(348 > 347)
if(349 > 348)
if(350 > 349)
if(351 > 350)
if(352 > 351)
if(353 > 352)
if(354 > 353)
if(355 > 354)
if(356 > 355)
if(357 > 356)
if(358 > 357)
if(359 > 358)
if(360 > 359)
if(361 > 360)
if(362 > 361)
if(363 > 362)
if(364 > 363)
if(365 > 364)
if(366 > 365)
if(367 > 366)
if(368 > 367)
if(369 > 368)
if(370 > 369)
if(371 > 370)
if(372 > 371)
if(373 > 372)
if(374 > 373)
if(375 > 374)
if(376 > 375)
if(377 > 376)
if(378 > 377)
if(379 > 378)
if(380 > 379)
if(381 > 380)
if(382 > 381)
if(383 > 382)
if(384 > 383)
if(385 > 384)
if(386 > 385)
if(387 > 386)
if(388 > 387)
if(389 > 388)
if(390 > 389)
if(391 > 390)
if(392 > 391)
if(393 > 392)
if(394 > 393)
if(395 > 394)
if(396 > 395)
if(397 > 396)
if(398 > 397)
if(399 > 398)
if(400 > 399)
if(401 > 400)
if(402 > 401)
if(403 > 402)
if(404 > 403)
if(405 > 404)
if(406 > 405)
if(407 > 406)
if(408 > 407)
if(409 > 408)
if(410 > 409)
if(411 > 410)
if(412 > 411)
if(413 > 412)
if(414 > 413)
if(415 > 414)
if(416 > 415)
if(417 > 416)
if(418 > 417)
if(419 > 418)
if(420 > 419)
if(421 > 420)
if(422 > 421)
if(423 > 422)
if(424 > 423)
if(425 > 424)
if(426 > 425)
if(427 > 426)
if(428 > 427)
if(429 > 428)
if(430 > 429)
if(431 > 430)
if(432 > 431)
if(433 > 432)
if(434 > 433)
if(435 > 434)
if(436 > 435)
if(437 > 436)
if(438 > 437)
if(439 > 438)
if(440 > 439)
if(441 > 440)
if(442 > 441)
if(443 > 442)
if(444 > 443)
if(445 > 444)
if(446 > 445)
if(447 > 446)
if(448 > 447)
if(449 > 448)
if(450 > 449)
if(451 > 450)
if(452 > 451)
if(453 > 452)
if(454 > 453)
if(455 > 454)
if(456 > 455)
if(457 > 456)
if(458 > 457)
if(459 > 458)
if(460 > 459)
if(461 > 460)
if(462 > 461)
if(463 > 462)
if(464 > 463)
if(465 > 464)
if(466 > 465)
if(467 > 466)
if(468 > 467)
if(469 > 468)
if(470 > 469)
if(471 > 470)
if(472 > 471)
if(473 > 472)
if(474 > 473)
if(475 > 474)
if(476 > 475)
if(477 > 476)
if(478 > 477)
if(479 > 478)
if(480 > 479)
if(481 > 480)
if(482 > 481)
if(483 > 482)
if(484 > 483)
if(485 > 484)
if(486 > 485)
if(487 > 486)
if(488 > 487)
if(489 > 488)
if(490 > 489)
if(491 > 490)
if(492 > 491)
if(493 > 492)
if(494 > 493)
if(495 > 494)
if(496 > 495)
if(497 > 496)
if(498 > 497)
if(499 > 498)
if(500 > 499)
if(501 > 500)
if(502 > 501)
if(503 > 502)
if(504 > 503)
if(505 > 504)
if(506 > 505)
if(507 > 506)
if(508 > 507)
if(509 > 508)
if(510 > 509)
if(511 > 510)
if(512 > 511)
if(513 > 512)
if(514 > 513)
if(515 > 514)
if(516 > 515)
if(517 > 516)
if(518 > 517)
if(519 > 518)
if(520 > 519)
if(521 > 520)
if(522 > 521)
if(523 > 522)
if(524 > 523)
if(525 > 524)
if(526 > 525)
if(527 > 526)
if(528 > 527)
if(529 > 528)
if(530 > 529)
if(531 > 530)
if(532 > 531)
if(533 > 532)
if(534 > 533)
if(535 > 534)
if(536 > 535)
if(537 > 536)
if(538 > 537)
if(539 > 538)
if(540 > 539)
if(541 > 540)
if(542 > 541)
if(543 > 542)
if(544 > 543)
if(545 > 544)
if(546 > 545)
if(547 > 546)
if(548 > 547)
if(549 > 548)
if(550 > 549)
if(551 > 550)
if(552 > 551)
if(553 > 552)
if(554 > 553)
if(555 > 554)
if(556 > 555)
if(557 > 556)
if(558 > 557)
if(559 > 558)
if(560 > 559)
if(561 > 560)
if(562 > 561)
if(563 > 562)
if(564 > 563)
if(565 > 564)
if(566 > 565)
if(567 > 566)
if(568 > 567)
if(569 > 568)
if(570 > 569)
if(571 > 570)
if(572 > 571)
if(573 > 572)
if(574 > 573)
if(575 > 574)
if(576 > 575)
if(577 > 576)
if(578 > 577)
if(579 > 578)
if(580 > 579)
if(581 > 580)
if(582 > 581)
if(583 > 582)
if(584 > 583)
if(585 > 584)
if(586 > 585)
if(587 > 586)
if(588 > 587)
if(589 > 588)
if(590 > 589)
if(591 > 590)
if(592 > 591)
if(593 > 592)
if(594 > 593)
if(595 > 594)
if(596 > 595)
if(597 > 596)
if(598 > 597)
if(599 > 598)
if(600 > 599)
if(601 > 600)
if(602 > 601)
if(603 > 602)
if(604 > 603)
if(605 > 604)
if(606 > 605)
if(607 > 606)
if(608 > 607)
if(609 > 608)
if(610 > 609)
if(611 > 610)
if(612 > 611)
if(613 > 612)
if(614 > 613)
if(615 > 614)
if(616 > 615)
if(617 > 616)
if(618 > 617)
if(619 > 618)
if(620 > 619)
if(621 > 620)
if(622 > 621)
if(623 > 622)
if(624 > 623)
if(625 > 624)
if(626 > 625)
if(627 > 626)
if(628 > 627)
if(629 > 628)
if(630 > 629)
if(631 > 630)
if(632 > 631)
if(633 > 632)
if(634 > 633)
if(635 > 634)
if(636 > 635)
if(637 > 636)
if(638 > 637)
if(639 > 638)
if(640 > 639)
if(641 > 640)
if(642 > 641)
if(643 > 642)
if(644 > 643)
if(645 > 644)
if(646 > 645)
if(647 > 646)
if(648 > 647)
if(649 > 648)
if(650 > 649)
if(651 > 650)
if(652 > 651)
if(653 > 652)
if(654 > 653)
if(655 > 654)
if(656 > 655)
if(657 > 656)
if(658 > 657)
if(659 > 658)
if(660 > 659)
if(661 > 660)
if(662 > 661)
if(663 > 662)
if(664 > 663)
if(665 > 664)
if(666 > 665)
if(667 > 666)
if(668 > 667)
if(669 > 668)
if(670 > 669)
if(671 > 670)
if(672 > 671)
if(673 > 672)
if(674 > 673)
if(675 > 674)
if(676 > 675)
if(677 > 676)
if(678 > 677)
if(679 > 678)
if(680 > 679)
if(681 > 680)
if(682 > 681)
if(683 > 682)
if(684 > 683)
if(685 > 684)
if(686 > 685)
if(687 > 686)
if(688 > 687)
if(689 > 688)
if(690 > 689)
if(691 > 690)
if(692 > 691)
if(693 > 692)
if(694 > 693)
if(695 > 694)
if(696 > 695)
if(697 > 696)
if(698 > 697)
if(699 > 698)
if(700 > 699)
if(701 > 700)
if(702 > 701)
if(703 > 702)
if(704 > 703)
if(705 > 704)
if(706 > 705)
if(707 > 706)
if(708 > 707)
if(709 > 708)
if(710 > 709)
if(711 > 710)
if(712 > 711)
if(713 > 712)
if(714 > 713)
if(715 > 714)
if(716 > 715)
if(717 > 716)
if(718 > 717)
if(719 > 718)
if(720 > 719)
if(721 > 720)
if(722 > 721)
if(723 > 722)
if(724 > 723)
if(725 > 724)
if(726 > 725)
if(727 > 726)
if(728 > 727)
if(729 > 728)
if(730 > 729)
if(731 > 730)
if(732 > 731)
if(733 > 732)
if(734 > 733)
if(735 > 734)
if(736 > 735)
if(737 > 736)
if(738 > 737)
if(739 > 738)
if(740 > 739)
if(741 > 740)
if(742 > 741)
if(743 > 742)
if(744 > 743)
if(745 > 744)
if(746 > 745)
if(747 > 746)
if(748 > 747)
if(749 > 748)
if(750 > 749)
if(751 > 750)
if(752 > 751)
if(753 > 752)
if(754 > 753)
if(755 > 754)
if(756 > 755)
if(757 > 756)
if(758 > 757)
if(759 > 758)
if(760 > 759)
if(761 > 760)
if(762 > 761)
if(763 > 762)
if(764 > 763)
if(765 > 764)
if(766 > 765)
if(767 > 766)
if(768 > 767)
if(769 > 768)
if(770 > 769)
if(771 > 770)
if(772 > 771)
if(773 > 772)
if(774 > 773)
if(775 > 774)
if(776 > 775)
if(777 > 776)
if(778 > 777)
if(779 > 778)
if(780 > 779)
if(781 > 780)
if(782 > 781)
if(783 > 782)
if(784 > 783)
if(785 > 784)
if(786 > 785)
if(787 > 786)
if(788 > 787)
if(789 > 788)
if(790 > 789)
if(791 > 790)
if(792 > 791)
if(793 > 792)
if(794 > 793)
if(795 > 794)
if(796 > 795)
if(797 > 796)
if(798 > 797)
if(799 > 798)
if(800 > 799)
if(801 > 800)
if(802 > 801)
if(803 > 802)
if(804 > 803)
if(805 > 804)
if(806 > 805)
if(807 > 806)
if(808 > 807)
if(809 > 808)
if(810 > 809)
if(811 > 810)
if(812 > 811)
if(813 > 812)
if(814 > 813)
if(815 > 814)
if(816 > 815)
if(817 > 816)
if(818 > 817)
if(819 > 818)
if(820 > 819)
if(821 > 820)
if(822 > 821)
if(823 > 822)
if(824 > 823)
if(825 > 824)
if(826 > 825)
if(827 > 826)
if(828 > 827)
if(829 > 828)
if(830 > 829)
if(831 > 830)
if(832 > 831)
if(833 > 832)
if(834 > 833)
if(835 > 834)
if(836 > 835)
if(837 > 836)
if(838 > 837)
if(839 > 838)
if(840 > 839)
if(841 > 840)
if(842 > 841)
if(843 > 842)
if(844 > 843)
if(845 > 844)
if(846 > 845)
if(847 > 846)
if(848 > 847)
if(849 > 848)
if(850 > 849)
if(851 > 850)
if(852 > 851)
if(853 > 852)
if(854 > 853)
if(855 > 854)
if(856 > 855)
if(857 > 856)
if(858 > 857)
if(859 > 858)
if(860 > 859)
if(861 > 860)
if(862 > 861)
if(863 > 862)
if(864 > 863)
if(865 > 864)
if(866 > 865)
if(867 > 866)
if(868 > 867)
if(869 > 868)
if(870 > 869)
if(871 > 870)
if(872 > 871)
if(873 > 872)
if(874 > 873)
if(875 > 874)
if(876 > 875)
if(877 > 876)
if(878 > 877)
if(879 > 878)
if(880 > 879)
if(881 > 880)
if(882 > 881)
if(883 > 882)
if(884 > 883)
if(885 > 884)
if(886 > 885)
if(887 > 886)
if(888 > 887)
if(889 > 888)
if(890 > 889)
if(891 > 890)
if(892 > 891)
if(893 > 892)
if(894 > 893)
if(895 > 894)
if(896 > 895)
if(897 > 896)
if(898 > 897)
if(899 > 898)
if(900 > 899)
if(901 > 900)
if(902 > 901)
if(903 > 902)
if(904 > 903)
if(905 > 904)
if(906 > 905)
if(907 > 906)
if(908 > 907)
if(909 > 908)
if(910 > 909)
if(911 > 910)
if(912 > 911)
if(913 > 912)
if(914 > 913)
if(915 > 914)
if(916 > 915)
if(917 > 916)
if(918 > 917)
if(919 > 918)
if(920 > 919)
if(921 > 920)
if(922 > 921)
if(923 > 922)
if(924 > 923)
if(925 > 924)
if(926 > 925)
if(927 > 926)
if(928 > 927)
if(929 > 928)
if(930 > 929)
if(931 > 930)
if(932 > 931)
if(933 > 932)
if(934 > 933)
if(935 > 934)
if(936 > 935)
if(937 > 936)
if(938 > 937)
if(939 > 938)
if(940 > 939)
if(941 > 940)
if(942 > 941)
if(943 > 942)
if(944 > 943)
if(945 > 944)
if(946 > 945)
if(947 > 946)
if(948 > 947)
if(949 > 948)
if(950 > 949)
if(951 > 950)
if(952 > 951)
if(953 > 952)
if(954 > 953)
if(955 > 954)
if(956 > 955)
if(957 > 956)
if(958 > 957)
if(959 > 958)
if(960 > 959)
if(961 > 960)
if(962 > 961)
if(963 > 962)
if(964 > 963)
if(965 > 964)
if(966 > 965)
if(967 > 966)
if(968 > 967)
if(969 > 968)
if(970 > 969)
if(971 > 970)
if(972 > 971)
if(973 > 972)
if(974 > 973)
if(975 > 974)
if(976 > 975)
if(977 > 976)
if(978 > 977)
if(979 > 978)
if(980 > 979)
if(981 > 980)
if(982 > 981)
if(983 > 982)
if(984 > 983)
if(985 > 984)
if(986 > 985)
if(987 > 986)
if(988 > 987)
if(989 > 988)
if(990 > 989)
if(991 > 990)
if(992 > 991)
if(993 > 992)
if(994 > 993)
if(995 > 994)
if(996 > 995)
if(997 > 996)
if(998 > 997)
if(999 > 998)
if(1000 > 999)
if(1001 > 1000)
if(1002 > 1001)
if(1003 > 1002)
if(1004 > 1003)
if(1005 > 1004)
if(1006 > 1005)
if(1007 > 1006)
if(1008 > 1007)
if(1009 > 1008)
if(1010 > 1009)
if(1011 > 1010)
if(1012 > 1011)
if(1013 > 1012)
if(1014 > 1013)
if(1015 > 1014)
if(1016 > 1015)
if(1017 > 1016)
if(1018 > 1017)
if(1019 > 1018)
if(1020 > 1019)
if(1021 > 1020)
if(1022 > 1021)
if(1023 > 1022)
if(1024 > 1023)
if(1025 > 1024)
if(1026 > 1025)
if(1027 > 1026)
if(1028 > 1027)
if(1029 > 1028)
if(1030 > 1029)
if(1031 > 1030)
if(1032 > 1031)
if(1033 > 1032)
if(1034 > 1033)
if(1035 > 1034)
if(1036 > 1035)
if(1037 > 1036)
if(1038 > 1037)
if(1039 > 1038)
if(1040 > 1039)
if(1041 > 1040)
if(1042 > 1041)
if(1043 > 1042)
if(1044 > 1043)
if(1045 > 1044)
if(1046 > 1045)
if(1047 > 1046)
if(1048 > 1047)
if(1049 > 1048)
if(1050 > 1049)
if(1051 > 1050)
if(1052 > 1051)
if(1053 > 1052)
if(1054 > 1053)
if(1055 > 1054)
if(1056 > 1055)
if(1057 > 1056)
if(1058 > 1057)
if(1059 > 1058)
if(1060 > 1059)
if(1061 > 1060)
if(1062 > 1061)
if(1063 > 1062)
if(1064 > 1063)
if(1065 > 1064)
if(1066 > 1065)
if(1067 > 1066)
if(1068 > 1067)
if(1069 > 1068)
if(1070 > 1069)
if(1071 > 1070)
if(1072 > 1071)
if(1073 > 1072)
if(1074 > 1073)
if(1075 > 1074)
if(1076 > 1075)
if(1077 > 1076)
if(1078 > 1077)
if(1079 > 1078)
if(1080 > 1079)
if(1081 > 1080)
if(1082 > 1081)
if(1083 > 1082)
if(1084 > 1083)
if(1085 > 1084)
if(1086 > 1085)
if(1087 > 1086)
if(1088 > 1087)
if(1089 > 1088)
if(1090 > 1089)
if(1091 > 1090)
if(1092 > 1091)
if(1093 > 1092)
if(1094 > 1093)
if(1095 > 1094)
if(1096 > 1095)
if(1097 > 1096)
if(1098 > 1097)
if(1099 > 1098)
if(1100 > 1099)
if(1101 > 1100)
if(1102 > 1101)
if(1103 > 1102)
if(1104 > 1103)
if(1105 > 1104)
if(1106 > 1105)
if(1107 > 1106)
if(1108 > 1107)
if(1109 > 1108)
if(1110 > 1109)
if(1111 > 1110)
if(1112 > 1111)
if(1113 > 1112)
if(1114 > 1113)
if(1115 > 1114)
if(1116 > 1115)
if(1117 > 1116)
if(1118 > 1117)
if(1119 > 1118)
if(1120 > 1119)
if(1121 > 1120)
if(1122 > 1121)
if(1123 > 1122)
if(1124 > 1123)
if(1125 > 1124)
if(1126 > 1125)
if(1127 > 1126)
if(1128 > 1127)
if(1129 > 1128)
if(1130 > 1129)
if(1131 > 1130)
if(1132 > 1131)
if(1133 > 1132)
if(1134 > 1133)
if(1135 > 1134)
if(1136 > 1135)
if(1137 > 1136)
if(1138 > 1137)
if(1139 > 1138)
if(1140 > 1139)
if(1141 > 1140)
if(1142 > 1141)
if(1143 > 1142)
if(1144 > 1143)
if(1145 > 1144)
if(1146 > 1145)
if(1147 > 1146)
if(1148 > 1147)
if(1149 > 1148)
if(1150 > 1149)
if(1151 > 1150)
if(1152 > 1151)
if(1153 > 1152)
if(1154 > 1153)
if(1155 > 1154)
if(1156 > 1155)
if(1157 > 1156)
if(1158 > 1157)
if(1159 > 1158)
if(1160 > 1159)
if(1161 > 1160)
if(1162 > 1161)
if(1163 > 1162)
if(1164 > 1163)
if(1165 > 1164)
if(1166 > 1165)
if(1167 > 1166)
if(1168 > 1167)
if(1169 > 1168)
if(1170 > 1169)
if(1171 > 1170)
if(1172 > 1171)
if(1173 > 1172)
if(1174 > 1173)
if(1175 > 1174)
if(1176 > 1175)
if(1177 > 1176)
if(1178 > 1177)
if(1179 > 1178)
if(1180 > 1179)
if(1181 > 1180)
if(1182 > 1181)
if(1183 > 1182)
if(1184 > 1183)
if(1185 > 1184)
if(1186 > 1185)
if(1187 > 1186)
if(1188 > 1187)
if(1189 > 1188)
if(1190 > 1189)
if(1191 > 1190)
if(1192 > 1191)
if(1193 > 1192)
if(1194 > 1193)
if(1195 > 1194)
if(1196 > 1195)
if(1197 > 1196)
if(1198 > 1197)
if(1199 > 1198)
if(1200 > 1199)
if(1201 > 1200)
if(1202 > 1201)
if(1203 > 1202)
if(1204 > 1203)
if(1205 > 1204)
if(1206 > 1205)
if(1207 > 1206)
if(1208 > 1207)
if(1209 > 1208)
if(1210 > 1209)
if(1211 > 1210)
if(1212 > 1211)
if(1213 > 1212)
if(1214 > 1213)
if(1215 > 1214)
if(1216 > 1215)
if(1217 > 1216)
if(1218 > 1217)
if(1219 > 1218)
if(1220 > 1219)
if(1221 > 1220)
if(1222 > 1221)
if(1223 > 1222)
if(1224 > 1223)
if(1225 > 1224)
if(1226 > 1225)
if(1227 > 1226)
if(1228 > 1227)
if(1229 > 1228)
if(1230 > 1229)
if(1231 > 1230)
if(1232 > 1231)
if(1233 > 1232)
if(1234 > 1233)
if(1235 > 1234)
if(1236 > 1235)
if(1237 > 1236)
if(1238 > 1237)
if(1239 > 1238)
if(1240 > 1239)
if(1241 > 1240)
if(1242 > 1241)
if(1243 > 1242)
if(1244 > 1243)
if(1245 > 1244)
if(1246 > 1245)
if(1247 > 1246)
if(1248 > 1247)
if(1249 > 1248)
if(1250 > 1249)
if(1251 > 1250)
if(1252 > 1251)
if(1253 > 1252)
if(1254 > 1253)
if(1255 > 1254)
if(1256 > 1255)
if(1257 > 1256)
if(1258 > 1257)
if(1259 > 1258)
if(1260 > 1259)
if(1261 > 1260)
if(1262 > 1261)
if(1263 > 1262)
if(1264 > 1263)
if(1265 > 1264)
if(1266 > 1265)
if(1267 > 1266)
if(1268 > 1267)
if(1269 > 1268)
if(1270 > 1269)
if(1271 > 1270)
if(1272 > 1271)
if(1273 > 1272)
if(1274 > 1273)
if(1275 > 1274)
if(1276 > 1275)
if(1277 > 1276)
if(1278 > 1277)
if(1279 > 1278)
if(1280 > 1279)
if(1281 > 1280)
if(1282 > 1281)
if(1283 > 1282)
if(1284 > 1283)
if(1285 > 1284)
if(1286 > 1285)
if(1287 > 1286)
if(1288 > 1287)
if(1289 > 1288)
if(1290 > 1289)
if(1291 > 1290)
if(1292 > 1291)
if(1293 > 1292)
if(1294 > 1293)
if(1295 > 1294)
if(1296 > 1295)
if(1297 > 1296)
if(1298 > 1297)
if(1299 > 1298)
if(1300 > 1299)
if(1301 > 1300)
if(1302 > 1301)
if(1303 > 1302)
if(1304 > 1303)
if(1305 > 1304)
if(1306 > 1305)
if(1307 > 1306)
if(1308 > 1307)
if(1309 > 1308)
if(1310 > 1309)
if(1311 > 1310)
if(1312 > 1311)
if(1313 > 1312)
if(1314 > 1313)
if(1315 > 1314)
if(1316 > 1315)
if(1317 > 1316)
if(1318 > 1317)
if(1319 > 1318)
if(1320 > 1319)
if(1321 > 1320)
if(1322 > 1321)
if(1323 > 1322)
if(1324 > 1323)
if(1325 > 1324)
if(1326 > 1325)
if(1327 > 1326)
if(1328 > 1327)
if(1329 > 1328)
if(1330 > 1329)
if(1331 > 1330)
if(1332 > 1331)
if(1333 > 1332)
if(1334 > 1333)
if(1335 > 1334)
if(1336 > 1335)
if(1337 > 1336)
if(1338 > 1337)
if(1339 > 1338)

Into this

if(1339> 1338) {
//do something.
}

Image description

Collapse
 
jencaadam profile image
Adam Jenča • Edited
if (len(_ll)>1 or '=' in _ll) and isinstance(_ll[0],str) and  _ll[0].split()[0]==_ll[0] and '(' not in _ll[0] and '[' not in _ll[0]:
Enter fullscreen mode Exit fullscreen mode

only 133 characters long, but coded in python - spare-space language.

Whole if-else block looks like

if 'name' not in kwargs and len(args)<3:


    if (len(_ll)>1 or '=' in _ll) and isinstance(_ll[0],str) and  _ll[0].split()[0]==_ll[0] and '(' not in _ll[0] and '[' not in _ll[0]:
         name=_ll[0]
    else:
         name='WraPy'
else:
    if 'name' in kwargs:
        name=kwargs['name']
        del kwargs['name']
    else:
        name=args[2]
        del args[2]
Enter fullscreen mode Exit fullscreen mode
Collapse
 
rheckers profile image
R Heckers • Edited

Mine is not that horrible and terrifying I guess:

if ((this.videoPlayer.currentTime >= action.start) && (this.videoPlayer.currentTime <= action.end) && !action['readmore']) {

I always try to minimize the code, otherwise it's hard to follow, and even easier to miss some value and break your head about :p