Skip to content
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

elseif #27

Closed
odino opened this issue Dec 19, 2018 · 0 comments
Closed

elseif #27

odino opened this issue Dec 19, 2018 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@odino
Copy link
Collaborator

odino commented Dec 19, 2018

No description provided.

@odino odino added the enhancement New feature or request label Dec 19, 2018
@odino odino modified the milestones: 0.9, preview-1, preview-2, preview-3 Dec 19, 2018
@odino odino modified the milestones: preview-3, 1.0 Dec 27, 2018
odino added a commit that referenced this issue Jan 26, 2019
This commit adds the ability to add multiple IF
conditions in an IF block by using `if else`:

```
if x {
  ...
} else if y {
  ...
} else if z {
  ...
} else {
  ...
}
```

I decided to change the data structure that represents
IFs because it was very limited, only allowing for
a condition, a consequence and an alternative consequence.

Now IFs are a list of `Scenario`, made of conditions and
consequences. If we encounter a bare `else` we set the condition
of that scenario to true, so that it always evaluates to true.

One funny thing that this structure does is that it allows
for code like this:

```
if x {
  ...
} else {
  ...
} else if y {
  ...
}
```

(`else` before `else if`)

I honestly don't mind having this (it's a fun easter egg), but
we might want to raise a parser error later on if users find it
annoying.
odino added a commit that referenced this issue Jan 26, 2019
This commit adds the ability to add multiple IF
conditions in an IF block by using `if else`:

```
if x {
  ...
} else if y {
  ...
} else if z {
  ...
} else {
  ...
}
```

I decided to change the data structure that represents
IFs because it was very limited, only allowing for
a condition, a consequence and an alternative consequence.

Now IFs are a list of `Scenario`, made of conditions and
consequences. If we encounter a bare `else` we set the condition
of that scenario to true, so that it always evaluates to true.

One funny thing that this structure does is that it allows
for code like this:

```
if x {
  ...
} else {
  ...
} else if y {
  ...
}
```

(`else` before `else if`)

I honestly don't mind having this (it's a fun easter egg), but
we might want to raise a parser error later on if users find it
annoying.
@odino odino closed this as completed Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant