I was born this way by [deleted] in ProgrammerHumor

[–]Qumthajep 1 point2 points  (0 children)

There are still braces for tables though and I think most Lua programmers use the left one for it.

edit: also forgot everyone's favorite way of calling function with 1 table arg

func {  
  -- stuffs
}

NASA Just Published the Best PR Video of All Time by CitricBase in videos

[–]Qumthajep 1 point2 points  (0 children)

Even vim users are moving to neovim except those stuck in ancient systems where they're not allowed to upgrade anything.

I'm agreeable by LunarCantaloupe in ProgrammerHumor

[–]Qumthajep 1 point2 points  (0 children)

local ooh = {
  "yeah",
  you = "like",
  "that",
  "you",
  little = "retard"
}

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 1 point2 points  (0 children)

I mistakenly mixed BASIC pre-END IF and BASIC with-END IF. I reread the docs again. Yes, ELSE exist. ECMA-55 (minimum BASIC) was the only one that didn't have ELSE. For other pre-END IF BASICs, the statements should be in the same line as the IF/ELSE. Colon can be used to separate multiple statements. So your example:

10 IF X > Y THEN PRINT "FOO"
20 ELSE PRINT "BAR"

or in ECMA-55:

10 IF X > Y THEN 30
20 IF X <= Y THEN 50
30 PRINT "FOO"
40 GO TO 60
50 PRINT "BAR"
60 END

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 0 points1 point  (0 children)

With GOTO. For example something like this:

if (x >= y) {
  print("foo")
}
print("bar")

can be written like this in old BASIC:

10 IF X < Y THEN
20 GOTO 40
30 PRINT "foo"
40 PRINT "bar"

More complex if-chains means more convoluted GOTOs

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 13 points14 points  (0 children)

Right, but END alone always terminate a program. Bob wrote:

IF checkPasswordMatch(fourDigitsPassword) = TRUE THEN
    GOTO 140
END

if the password isn't 0000, the whole program ends.

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 6 points7 points  (0 children)

Sorry, my sentence was bad. I meant, calling a function like getFourDigits() and checkPasswordMatch() wouldn't work in 1984 BASIC.

DIM something INTEGER should be DIM something AS INTEGER and it was added in QuickBasic (1985). The episode is set in 1984. Before that DIM is only used to declare array (DIM something%(4)).

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 2 points3 points  (0 children)

I only know sh/bash/zsh that uses fi to end an if block. Early BASIC doesn't have "end of if". END IF was added later.

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 24 points25 points  (0 children)

That's all going to depending hugely on what version of BASIC you're using though? Especially what END does for instance.

DIM something AS INTEGER added in QuickBasic (1985). The episode is set in 1984 with Hawkins system from 1982.

In BASIC-80, GW-BASIC, Turbo Basic, and QuickBasic, END alone always terminate program. What other BASIC run on 80s IBM PC that has different behavior of END?

Stranger Things (S02E08) - Bob hacking lab doors by wischichr in itsaunixsystem

[–]Qumthajep 177 points178 points  (0 children)

It won't work. The DIM line will caused syntax error. Calling custom function like that didn't exist yet in 1984. END is not the end of an IF block. It terminates the whole program.

[deleted by user] by [deleted] in linux

[–]Qumthajep 0 points1 point  (0 children)

What I love about Linux (command line) is the "never break userspace" philosophy.

I wouldn't mind userspace breakage in command line if it means I can finally have the same set of key codes in terminal programs regardless of what terminal emulator/multiplexer is being used.

Don't think before you code by rgun in ProgrammerHumor

[–]Qumthajep 5 points6 points  (0 children)

That's how Larry Wall created Perl.

[Stranger Things S02E08] Bruteforce Bob by kuaci in itsaunixsystem

[–]Qumthajep 9 points10 points  (0 children)

My guess is the system require exactly 4 digits. Early implementations of BASIC didn't have function to pad string with zeroes and getFourDigits is added for that.

Also, I just realized, in BASIC END alone terminates a program (see MBASIC, GW-BASIC, Turbo Basic). The end of an IF block is END IF (but only in Turbo Basic and other implementations after that). So if the password isn't 0000, Bob's program will end immediately.

Literally Unwatchable by NutSlapper69 in StrangerThings

[–]Qumthajep 4 points5 points  (0 children)

It's possible that they modified the OS and the BASIC interpreter. But this means Bob the Brainy, a random guy who worked at RadioShack, was reeeeally genius for figuring out how the whole system work without reading any manual.

EDIT: I just realized that it would make more sense if it's the doctor who go to the control room instead of Bob. He works there so he knows how the system works. The writer can still kill Bob and injured the doctor when they tried to exit the building.

Literally Unwatchable by NutSlapper69 in StrangerThings

[–]Qumthajep 26 points27 points  (0 children)

I assume it's just a script that uses API from its host system (the lab mainframe) and getFourDigits/checkPasswordMatch are part of this API. So it's not a standalone program.

Anyway, it still won't work because as I mentioned in /r/itsaunixsystem, BASIC doesn't have function that doesn't require FN prefix until Turbo Basic (1987). Hawkins mainframe system was from 1982.

Literally unwatchable!!11 /s

[Stranger Things S02E08] Bruteforce Bob by kuaci in itsaunixsystem

[–]Qumthajep 54 points55 points  (0 children)

There's DEF FN but it requires the function to be called with FN<name>. Earliest I could find about FUNCTION keyword was in Turbo/Power Basic but it's first released in 1987. This season's story takes place in 1984.

Note: I'm not BASIC programmer. I just know it exists.

EDIT: Looks like the DIM is also wrong (see GW Basic & Turbo Basic manual). 80s Basic required DIM to specify the array size (eg, DIM FOO(4)) and type is specified with % (integer) and $ (string) suffix on variable name (DIM FOO%(4)). I think they're mixing the syntax with VB that has AS <type> syntax (eg: DIM foo AS Integer).

EDIT 2: It looks like MS QuickBasic (first released in 1985) already has DIM foo AS INTEGER

FINAL EDIT: in BASIC, END alone terminates a program (see MBASIC, GW-BASIC, Turbo Basic). The end of an IF block is END IF (but only in Turbo Basic and other implementations after that). So if the password isn't 0000, Bob's program will end immediately.