0x0@lemmy.zip to Programmer Humor@programming.dev · 6 days agotough choice?lemmy.zipexternal-linkmessage-square76fedilinkarrow-up1545arrow-down112
arrow-up1533arrow-down1external-linktough choice?lemmy.zip0x0@lemmy.zip to Programmer Humor@programming.dev · 6 days agomessage-square76fedilink
minus-squareSlashme@lemmy.worldlinkfedilinkarrow-up2·edit-21 day agoRemember that Fortran has an arithmetic if statement. You can write IF (expression) s1, s2, s3 where s1, s2 and s3 are labels. If the expression is negative, it jumps to s1. If it’s 0, to s2 and if it’s positive, to s3. It also has goto variable. You can do INTEGER a ASSIGN 20 TO a ASSIGN 17 TO a GO TO a 20 PRINT *, "foo" 17 PRINT *, "bar" and it’ll print “bar”. In this snippet of code, everything seems quite logical, but imagine debugging spaghetti code written using these patterns. Oh, it also has GO TO (s1, s2, ... , sn), N First, N is converted to an integer. If N is 1, it goes to label s1. If N is 2, it goes to s2. If N is less than 1 or greater than n, it does nothing.
Remember that Fortran has an arithmetic if statement. You can write
where s1, s2 and s3 are labels. If the expression is negative, it jumps to s1. If it’s 0, to s2 and if it’s positive, to s3.
It also has goto variable. You can do
and it’ll print “bar”. In this snippet of code, everything seems quite logical, but imagine debugging spaghetti code written using these patterns.
Oh, it also has
First, N is converted to an integer. If N is 1, it goes to label s1. If N is 2, it goes to s2. If N is less than 1 or greater than n, it does nothing.