Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope per blocchi diversi da funzioni #6

Closed
boozec opened this issue Jun 24, 2024 · 6 comments
Closed

Scope per blocchi diversi da funzioni #6

boozec opened this issue Jun 24, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@boozec
Copy link
Owner

boozec commented Jun 24, 2024

Guardando con @L0P0P abbiamo notato che per i blocchi diversi dalle funzioni non ha senso aumentarne l'offset.
Ad esempio,

x = 10
if x == 10:
	x = 3

print(x) # 3

invece ha senso per roba del tipo

x = 10
def foo():
	if x == 10:
		x = 3
	print(x) # 3

foo()
print(x) # 10
@L0P0P L0P0P added the help wanted Extra attention is needed label Jun 24, 2024
@boozec
Copy link
Owner Author

boozec commented Jun 25, 2024

Meglio visto in un esempio (simil slide):

int x = 10;
if (x == 10) {
	int x = 3;
}
printf("%d", x); /* 10 */

@boozec
Copy link
Owner Author

boozec commented Jun 25, 2024

Il magnifico @gabrielegenovese ci suggerisce un esempio, a detta sua, migliore:

x = 10
if x == 10:
	x = 3
	a = 2

print(x, a) # 3, 2

@L0P0P
Copy link
Collaborator

L0P0P commented Jun 25, 2024

Il secondo non funziona..

@boozec
Copy link
Owner Author

boozec commented Jun 25, 2024

Il secondo non funziona..

chiedo SUCA

@L0P0P L0P0P added documentation Improvements or additions to documentation invalid This doesn't seem right wontfix This will not be worked on enhancement New feature or request and removed help wanted Extra attention is needed documentation Improvements or additions to documentation invalid This doesn't seem right wontfix This will not be worked on labels Jun 25, 2024
@boozec
Copy link
Owner Author

boozec commented Jun 27, 2024

Non abbiamo aumentato offset da nessuna parte in #10 e va tutto bene. Che famo con questa issue? @L0P0P @gabrielegenovese

@L0P0P
Copy link
Collaborator

L0P0P commented Jul 2, 2024

Teniamola fino a quando non iniziamo a trattare gli offset per l'esercizio 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants