Change the structure of if-command in level 4 #901
MarleenGilsing
started this conversation in
Language Ideas
Replies: 1 comment 1 reply
-
For me it is a lot more clear with this change. However I am not so sure if it better for the students. Some thought I have:
So not a big yes or no for me. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@Felienne and I were talking about the structure of the if-command.
We started out with:
if name is Hedy print 'fun' else ' print 'not fun'
We've already changed it to:
if name is Hedy print 'fun'
else print 'not fun'
But we'd like to change it to:
if name is Hedy
print 'fun'
else
print 'not fun'
This has the advantage that it looks more like Python structure and it makes the lines of code shorter and easier to oversee.
It does make it harder to see that these lines are a block and belong together. That's why we thought it would be a good idea to teach the students to use enters before and after this block to make it a block visually. (But Hedy will also work if you don't use the enters). So it will look like this:
print 'Hello Im Hedy'
name is ask 'Whats your name?'
if name is hedy
print 'fun'
else
print 'not fun'
print 'Nice to meet you!'
print 'Bye now.'
@OnnoEbbens What do you think of this change?
Beta Was this translation helpful? Give feedback.
All reactions