Deutsch English Français Italiano |
<vnj7or$ga7$3@reader2.panix.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.os.vms Subject: Re: basic BASIC question Date: Fri, 31 Jan 2025 19:19:55 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <vnj7or$ga7$3@reader2.panix.com> References: <vnipj8$3i2i9$1@dont-email.me> <vnj4pb$3kfrs$1@dont-email.me> <679d180f$0$713$14726298@news.sunsite.dk> <679d18c2$0$713$14726298@news.sunsite.dk> Injection-Date: Fri, 31 Jan 2025 19:19:55 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="16711"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross) Bytes: 2310 Lines: 76 In article <679d18c2$0$713$14726298@news.sunsite.dk>, Arne Vajhøj <arne@vajhoej.dk> wrote: >On 1/31/2025 1:35 PM, Arne Vajhøj wrote: >> On 1/31/2025 1:28 PM, Simon Clubley wrote: >>> On 2025-01-31, Arne Vajhøj <arne@vajhoej.dk> wrote: >>>> Is it common to use: >>>> >>>> declare integer constant TRUE = -1 >>>> declare integer constant FALSE = 0 >>> >>> Oh goody. The "good" old days, when TRUE did not equal TRUE, are >>> back. :-) >> >> Some old some new. >> >> C and VMS Basic are old. >> >> But some newer script languages also have a >> "flexible approach" to true/false. >> >> $ type bool.php >> <?php >> >> function test($expr) { >> echo ($expr ? 'true' : 'false') . "\r\n"; >> } >> >> test(true); >> test(false); >> test(1); >> test(0); >> test(-1); >> test("X"); >> test(""); >> test(null); >> >> ?> >> $ php bool.php >> true >> false >> true >> false >> true >> true >> false >> false > >$ type bool.py >def test(expr): > print("true" if expr else "false") > >test(True) >test(False) >test(1) >test(0) >test(-1) >test("X") >test("") >test(None) >$ python bool.py >true >false >true >false >true >true >false >false If you really want to have a good time, look at how JavaScript deals with this. Things aren't just true or false, they're truthy and falsy, and sometimes Nan. https://www.youtube.com/watch?v=et8xNAc2ic8 - Dan C.