Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37987
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Logical conundrums if () else if() |
| Date | 2019-12-29 11:43 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2136104.ElGaqSPkdT@PointedEars.de> (permalink) |
| References | <cd84bfc2-63ac-4a4f-bd76-9b144035b9ba@googlegroups.com> <a94feae5-f0fe-4a0e-bb87-ce60d20695ff@googlegroups.com> |
Michael Haufe (TNO) wrote:
> ```javascript
This is not a Markdown document :)
> if (elLockedit.checked && EDITEND < SELEND) {
>
> } else if (EDITEND < SELEND) {
>
> }
DRY:
const selectionEdited = (EDITEND < SELEND);
if (elLockedit.checked && selectionEdited) {
// …
} else if (selectionEdited) {
// …
}
Which leads us to
if (selectionEdited) {
if (elLockedit.checked) {
// …
}
else {
// …
}
}
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Logical conundrums if () else if() Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-28 00:40 -0800
Re: Logical conundrums if () else if() "R.Wieser" <address@not.available> - 2019-12-28 12:21 +0100
Re: Logical conundrums if () else if() Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-28 05:32 -0800
Re: Logical conundrums if () else if() "R.Wieser" <address@not.available> - 2019-12-28 19:10 +0100
Re: Logical conundrums if () else if() Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-28 12:16 -0800
Re: Logical conundrums if () else if() "R.Wieser" <address@not.available> - 2019-12-29 08:52 +0100
Re: Logical conundrums if () else if() Arno Welzel <usenet@arnowelzel.de> - 2019-12-30 21:35 +0100
Re: Logical conundrums if () else if() Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-30 12:42 -0800
Re: Logical conundrums if () else if() "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-12-28 09:37 -0800
Re: Logical conundrums if () else if() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-12-29 11:43 +0100
Re: Logical conundrums if () else if() "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-12-29 08:14 -0800
Re: Logical conundrums if () else if() Soviet_Mario <SovietMario@CCCP.MIR> - 2020-01-18 21:06 +0100
Re: Logical conundrums if () else if() Soviet_Mario <SovietMario@CCCP.MIR> - 2020-01-19 01:22 +0100
csiph-web