0

jeez I don't understand this issue of indentation. I noticed that the instructions or methods that run within or outside a conditional are looped in a certain way. the way print() is indented affects what will be printed. pls who has any insight on this frustrating stuff

7th Aug 2016, 1:47 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
5 odpowiedzi
+ 1
condition a: stuff that happens for condition a - first word is aligned to the right of the first word of condition a also stuff that happens for condition a - first word is aligned to the right of the first word of condition a still stuff that happens for condition a - first word is aligned to the right of the first word of condition a no longer stuff for condition a, but for the next part of the program - first word lines up with first word of condition a another bit of the program condition b: stuff that happens for condition b - first word aligned to right of first word of condition b
9th Sep 2016, 2:25 PM
Phil
Phil - avatar
0
sorry not looped but indented in a certain way. please replace with indented in the question I asked
7th Aug 2016, 1:48 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
0
I mean that indentations vary through out a list of codes. I don't understand how to indent correctly
7th Aug 2016, 1:49 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
0
Indents are spaces if you use any tab it won't recognize it and will give an error. I think four spaces is standard practise.
8th Aug 2016, 3:27 AM
Matthew Olson
Matthew Olson - avatar
0
my $0.02: other languages use brackets to enclose blocks of code, e.g. a while loop python uses indentation. int i = 0 while i < 10: #do this #and this #and this i += 1 #but not this until after while loop is complete
8th Aug 2016, 4:47 AM
Izz
Izz - avatar