Skip to main content
Commonmark migration
Source Link

Group statements via tuples

#Group statements via tuples Let'sLet's assume the simplest case: you have two statements that return a value and would like to group them into one that returns the second value (perhaps the first one has useful side effects):

(s1,o:s2).o

This can be used along with inline variable declarations via is:

(s1 is var x,o:f(x,g(x))).o

It also works with the void -> value transformation via is int (although it doesn't always help):

(Print(x)is int,o:f(x)).o

#Group statements via tuples Let's assume the simplest case: you have two statements that return a value and would like to group them into one that returns the second value (perhaps the first one has useful side effects):

(s1,o:s2).o

This can be used along with inline variable declarations via is:

(s1 is var x,o:f(x,g(x))).o

It also works with the void -> value transformation via is int (although it doesn't always help):

(Print(x)is int,o:f(x)).o

Group statements via tuples

Let's assume the simplest case: you have two statements that return a value and would like to group them into one that returns the second value (perhaps the first one has useful side effects):

(s1,o:s2).o

This can be used along with inline variable declarations via is:

(s1 is var x,o:f(x,g(x))).o

It also works with the void -> value transformation via is int (although it doesn't always help):

(Print(x)is int,o:f(x)).o
Source Link
the default.
  • 8.4k
  • 1
  • 36
  • 62

#Group statements via tuples Let's assume the simplest case: you have two statements that return a value and would like to group them into one that returns the second value (perhaps the first one has useful side effects):

(s1,o:s2).o

This can be used along with inline variable declarations via is:

(s1 is var x,o:f(x,g(x))).o

It also works with the void -> value transformation via is int (although it doesn't always help):

(Print(x)is int,o:f(x)).o