Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38087
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Soviet_Mario <SovietMario@CCCP.MIR> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Logical conundrums if () else if() |
| Date | Sun, 19 Jan 2020 01:22:12 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 52 |
| Message-ID | <r007fk$3cu$1@dont-email.me> (permalink) |
| References | <cd84bfc2-63ac-4a4f-bd76-9b144035b9ba@googlegroups.com> <qvvogi$af3$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| Injection-Date | Sun, 19 Jan 2020 00:22:12 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="2d84ae1261988923f66e02eef1192a59"; logging-data="3486"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/clnVAG1F/msKkDOPIq8xg" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
| Cancel-Lock | sha1:rsD4Cjma6JetTm/YlRu6ZJyn9Qs= |
| In-Reply-To | <qvvogi$af3$1@dont-email.me> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.javascript:38087 |
Show key headers only | View raw
On 18/01/20 21:06, Soviet_Mario wrote:
> On 28/12/19 09:40, Jonas Thörnvall wrote:
>> How can two if statements that work perfectly standalone
>> as single statments.
>> Make outcome that differs when you put in, an else if
>> statement to only execute one of them. The below
>> statements have the statement with heavier conditioning
>> first so not the second statement gets executed. Because
>> both satisfy the noneboolean condition.
>>
>> I probably done some very no no thingy.
>>
>>
>>
>> if (EDITEND<SELEND &&
>> document.getElementById("lockedit").checked){
>> SELLENGTH=SELEND-SELSTART;
>> document.getElementById("SB").value=EDITSTART+SELLENGTH;
>> document.getElementById("EB").value=SELEND;
>> } else if (EDITEND<SELEND){
>> document.getElementById("EB").value=SELEND;}
>>
>
> do you have the rock solid warranty that none of the
> statements/function calls MODIFIES the internal status of
> the objects probed ?
> If somewhere sth gets changed by the inquiry, the order
> could become relevant.
>
> a trivial example of what I mean
>
> int q, k = 0;
> if (k == 0) q = 0; else if (++ k != 0) q = 1;
> if (++ k != 0) q = 0; else if (k == 0) q = 1;
>
> the state of q depends on the order the two tests on k are
> executed.
>
> maybe getElementById alters sth ... dunno ...
>
>
sorry I am in the wrong NG :( I thought I was reading C++ NG
... the syntax is similar at times
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Back to comp.lang.javascript | Previous | Next — Previous 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