News for hackers. Stuff that matters.
Re:A constructive look at the Atari 2600 BASIC cartridge by fortran77 on Wednesday January 06, 2021 @02:34PM (#25661286)

     I almost forgot—the IF statement is an expression! You can do the following:

     A ← IF B = 15 THEN 40 ELSE 99
     and A will be 40 if B is 15, otherwise A will be 99. There aren't many languages I've used that have allowed this
I need to introduce this man to the wonderful world of Haskell, Erlang, and other Functional Programming Languages.
Re:A constructive look at the Atari 2600 BASIC cartridge by sedatk on Wednesday January 06, 2021 @04:06PM (#25662490)
That's very confusing as other BASIC dialects had used the same syntax in lieu of GOTO. `IF B = 15 THEN 40 ELSE 99` would be equivalent to `IF B = 15 THEN GOTO 40 ELSE GOTO 99`.
Re:A constructive look at the Atari 2600 BASIC cartridge by KSS42 on Wednesday January 06, 2021 @02:47PM (#25661403)
Verilog has a conditional operator ?:

condition ? value_if_true : value_if_false

It is used quite extensively in ASIC design.

Re:A constructive look at the Atari 2600 BASIC cartridge by bluedino on Wednesday January 06, 2021 @03:04PM (#25661574)
As does C, Ruby...
Re:A constructive look at the Atari 2600 BASIC cartridge by kgwxd on Wednesday January 06, 2021 @03:26PM (#25661935)
Clojure: (def a (if (= b 15) 40 99))

Also: (def a (cond (= b 15) 40 (= b 20) 50 :else 99))

Re:A constructive look at the Atari 2600 BASIC cartridge by jaymzcampbell on Wednesday January 06, 2021 @02:59PM (#25661510)
Python also lets you do this, definitley a nice bit of sugar

``` In [2]: b = 15; In [3]: a = 40 if b == 15 else 99; In [4]: a; Out[4]: 40; ```

Re:A constructive look at the Atari 2600 BASIC cartridge by mattw2121 on Wednesday January 06, 2021 @03:10PM (#25661670)
and PHP

``` $a = $b == 15 ? 40 : 99; ```

Re:A constructive look at the Atari 2600 BASIC cartridge by 0x7755XP on Wednesday January 06, 2021 @05:01PM (#25663220)
It's identical to the ternary operator (for most c like programming languages)
Re:A constructive look at the Atari 2600 BASIC cartridge by dragonwriter on Wednesday January 06, 2021 @10:12PM (#25666823)
Is there a popular language today that doesn't have conditional expressions?
Re:A constructive look at the Atari 2600 BASIC cartridge by reaperducer on Wednesday January 06, 2021 @10:27PM (#25666926)
I'm not sure it's fair to compare a language from 1979 to one from "today." Especially one that fit an entire IDE into 4,096 bytes.
Re:A constructive look at the Atari 2600 BASIC cartridge by dragonwriter on Wednesday January 06, 2021 @10:51PM (#25667089)
> I'm not sure it's fair to compare a language from 1979 to one from "today." Especially one that fit an entire IDE into 4,096 bytes.

I think it is fair to treat a “not many languages I've used...” comment about a language feature from a 2015 review in the context of current (or, at least, available in 2015) languages, even if the review is of a 1979 product.

Re:A constructive look at the Atari 2600 BASIC cartridge by bitwize on Wednesday January 06, 2021 @07:09PM (#25664778)
To say nothing of Lisp. Or C with its ?: operator.
Re:A constructive look at the Atari 2600 BASIC cartridge by Technically on Wednesday January 06, 2021 @08:31PM (#25666047)
What language does not have a form of a conditional expression?
Re:A constructive look at the Atari 2600 BASIC cartridge by Mountain_Skies on Wednesday January 06, 2021 @03:29PM (#25661984)
Why is this desirable? It saves maybe half a dozen keystrokes in exchange for less readable and thus less maintainable code.
Re:A constructive look at the Atari 2600 BASIC cartridge by jandrese on Wednesday January 06, 2021 @04:41PM (#25662960)
On the 2600 if it saved you a byte or two it was a big win. Remember your program had to fit in 64 bytes of memory. Not kilobytes, single bytes. And your numbers are BCD encoded, so they're extra inefficient.
Re:A constructive look at the Atari 2600 BASIC cartridge by Technically on Wednesday January 06, 2021 @08:32PM (#25666050)
If expressing a conditional costs you more than 1/64 of your storage I'd say the storage is pretty useless for storing code.
Re:A constructive look at the Atari 2600 BASIC cartridge by jandrese on Thursday January 07, 2021 @03:04PM (#25676569)
Nobody has ever accused Atari Basic of being good.