Re: can't access an alias created inside an if statement

2020-08-05 Thread Flade via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 09:39:47 UTC, Simen Kjærås wrote: On Wednesday, 5 August 2020 at 09:32:58 UTC, Flade wrote: Thanks! You see it should work but the thing is. I'm using it inside a function. I'm checking for one of the function's parameter (if parameter == false) and it says that

Re: can't access an alias created inside an if statement

2020-08-05 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 09:32:58 UTC, Flade wrote: Thanks! You see it should work but the thing is. I'm using it inside a function. I'm checking for one of the function's parameter (if parameter == false) and it says that "the variable `parameter` cannot be read at compile time. Do you

Re: can't access an alias created inside an if statement

2020-08-05 Thread Flade via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 09:25:23 UTC, Simen Kjærås wrote: On Wednesday, 5 August 2020 at 09:05:36 UTC, Flade wrote: I have used an if-else statement to create an alias to avoid code duplication but it doesn't let me access it outside the if statement. Is there a way to solve this?

Re: can't access an alias created inside an if statement

2020-08-05 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 09:05:36 UTC, Flade wrote: I have used an if-else statement to create an alias to avoid code duplication but it doesn't let me access it outside the if statement. Is there a way to solve this? You're probably looking for static if: static if (useAlias) {

can't access an alias created inside an if statement

2020-08-05 Thread Flade via Digitalmars-d-learn
I have used an if-else statement to create an alias to avoid code duplication but it doesn't let me access it outside the if statement. Is there a way to solve this?