Replies: 2 comments
-
|
I'd like to add, that named tuples would be useful (outside function application context). |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think that in verse the syntax would not have parenthesis, since that would be creating another tuple enclosing context, instead of just assigning to variables accessible on the current context... MyTuple := (25, 35.0)
A, B := MyTuple
var X : int, Y : float = MyTupleAlso, "swap" operations would be very handy: var X : int = 10
var Y : int = 15
# Direct swap without temp variables
set Y, X = X, Y
# X is 15
# Y is 10
# Alternative syntax (tuples) - just example:
var (X : int, Y : float) = MyTuple
set (Y, X) = (X, Y)This would be awesome, currently to do that we need to make "dummy" temp variables, which is an extra step: var X : int = 10
var Y : int = 15
# Store old value on a variable to reuse later (not optimal)
TempX := X
set X = Y
set Y = TempX
# X is 15
# Y is 10 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Permit destructuring a tuple anywhere. Verse book already showed that this feature is possible with function parameters.
Beta Was this translation helpful? Give feedback.
All reactions