Intending code

BlitzPlus Forums/BlitzPlus Beginners Area/Intending code

Cactus1124(Posted 2014) [#1]
I have been given feedback on many of my posts to intend my code. They say it really helps when reading it. The thing is, I don't know how to properly intend a piece of code... Can somebody help me? Please reply!

-Thanks


Who was John Galt?(Posted 2014) [#2]
Not much to it. Basically you get blocks in your code that will only run if a condition is met (e.g. the surrounding if/endif statements). Every time you have an if, you indent one tab with the tab key on the following line. Every time you hit an endif, you delete the tab. This allows you to see the conditional code quickly by the presence of the tab, and allows you to quickly see all the ifs/endifs are paired.
if (a>1)
   apple=2
   print "apple"
endif

for x=1 to 5
   print x
   if (x>3)
      print "X bigger than 3"
   endif
next



Who was John Galt?(Posted 2014) [#3]
BTW, it's INDENT not INTEND. Not being a grammar Nazi, just pointing it out.