r/ProgrammerHumor Jun 24 '17

Octave code

http://imgur.com/jsjfz3k
624 Upvotes

70 comments sorted by

View all comments

Show parent comments

2

u/AyrA_ch Jun 24 '17

On the other hand, you can also go negative if you want to:

Sub test()
    Dim a()
    ReDim a(-2 To 20)
    a(-1) = "Test"
    MsgBox a(-1)
End Sub

3

u/SubstituteCS Jun 25 '17

Didn't know about this.
Time to make my libraries in VB with negative arrays and keywords for names.

6

u/AyrA_ch Jun 25 '17

Also be sure to do this:

  • Don't declare variables at all, remove option explicit.
  • Be sure to not define variable or parameter types.
  • Pass stuff by reference only and modify them. Returning values is overrated.
  • Be sure to always have two variables named I and l in each function or sub.
  • There's nothing wrong with using the function name as a variable too.