Re: What does the [] operator do here?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 19:35:30 UTC, Net wrote: from the below code, the expression "case [c]": void main() { import std.stdio, std.string, std.algorithm, std.conv; // Reduce the RPN expression using a stack readln.split.fold!((stack, op) { switch (op) {

Re: What does the [] operator do here?

2020-04-01 Thread Net via Digitalmars-d-learn
oh, i see. That was a dump question. I don't code in D has been a while and totally forget to create a new array was as simple as []

Re: What does the [] operator do here?

2020-04-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/1/20 3:35 PM, Net wrote: from the below code, the expression "case [c]": void main() {     import std.stdio, std.string, std.algorithm, std.conv;     // Reduce the RPN expression using a stack     readln.split.fold!((stack, op)     {     switch (op)     {     //

Re: What does the [] operator do here?

2020-04-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 19:35:30 UTC, Net wrote: from the below code, the expression "case [c]": That's just an array literal, so the same as like "" ~ c

What does the [] operator do here?

2020-04-01 Thread Net via Digitalmars-d-learn
from the below code, the expression "case [c]": void main() { import std.stdio, std.string, std.algorithm, std.conv; // Reduce the RPN expression using a stack readln.split.fold!((stack, op) { switch (op) { // Generate operator switch cases statically