en la misma linea

S

Sebastian Bassi

Hola,

Aca con una pregunta basica:
A veces veo que hay programas que tienen varias instrucciones en la
misma linea, cuando lo que aprendi de Python era que se usaba el
espaciado para mantener la estructura (indent).
Por ejemplo:
if name != 'comic': return
Hay un return despues de los dos puntos, no se que significa.
 
H

Heiko Wundram

Sebastian said:
Por ejemplo:
if name != 'comic': return
Hay un return despues de los dos puntos, no se que significa.

I can't write spanish, but nevertheless maybe an english answer is of help.
Yes, it's allowed to write that, and it is the same as:

if name != 'comic':
return

You are only allowed to write one statement behind a colon, though (except
with a little more hackery using semicolons, but forget that).

You should read up on the Python grammar...

--- Heiko.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top