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
5 Respostas
+ 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
0
sorry not looped but indented in a certain way. please replace with indented in the question I asked
0
I mean that indentations vary through out a list of codes. I don't understand how to indent correctly
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.
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