You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
No description provided.
The text was updated successfully, but these errors were encountered: