-
Notifications
You must be signed in to change notification settings - Fork 4
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
Declare many variables which have the same type just in one line? #536
Comments
I think we could add syntax like Usefulness: At first I thought we don't need this because Python doesn't have it, but Jou needs this more than Python. For example, consider the following code, taken from last year's AoC solutions: x: long
y: long
z: long
dx: long
dy: long
dz: long
assert fscanf(f, "%lld, %lld, %lld @ %lld, %lld, %lld\n", &x, &y, &z, &dx, &dy, &dz) == 6
result[i] = MovingPoint{start = [x,y,z], speed = [dx,dy,dz]} In Python, I would probably do this instead: x, y, z, dx, dy, dz = map(int, re.findall("-?\d+", line))
result.append(MovingPoint(start=(x, y, z), speed=(dx, dy, dz)) Problem: What should the following do? Is x, y: int = 123 If If |
It's tempting to add |
I think:
@littlewhitecloud What do you think? |
I agree. Is there a syntax for assign multiple variables like this?
If so, I think we should raise error like this:
|
I thought so, but turns out there isn't. It can be added later if needed. |
I have noticed that when declaring variables in jou, we need to use a lot of lines which is unnecessary.
So should we create a syntax to combine them into just one line?
The text was updated successfully, but these errors were encountered: