I'm studying the basic grammar of python with Progate, so I will summarize the differences from ruby.
・ Enclose in if ~ end
x = 100
if x == 100
print "x is 100"
else
print "x is not 100"
end
-Add ": (colon)" at the end of the conditional expression -Indent the description of the process to be executed
x = 100
if x == 100:
print('x is 100')
else:
print('x is not 100')
Indentation directly affects the operation of python, so it's good that it naturally seems to be highly readable code.
Recommended Posts