BUG: Setting string variable within conditional block creates undesired glue
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
I am running into a problem with the following pattern:
```
-> top_knot
VAR _helloTarget = "Placeholder"
=== top_knot ===
{say_hello()}.
{say_hello()}!
How are you today?
-> END
=== function say_hello() ===
{
- say_hello %2 == 1:
~ _helloTarget = "Timmy"
- else:
~ _helloTarget = "Jimmy"
}
Hello, {_helloTarget}
```
This creates the following output:
> Hello, Timmy.Hello, Jimmy!
>
> How are you today?
>
> End of story
The line break structure here is not what I want - there seems to be some mysterious glue being added to my script. After deleting the conditional block that sets _helloTarget's value...
```
=== function say_hello() ===
Hello, {_helloTarget}
```
I get the following output, with the correct line break structure but obviously the wrong text:
> Hello, Placeholder.
>
> Hello, Placeholder!
>
> How are you today?
>
> End of story
If I set _helloTarget without a conditional, I get the right line break structure, but again there is no way to get the right names:
```
=== function say_hello() ===
~ _helloTarget = "Timmy"
Hello, {_helloTarget}
```
> Hello, Timmy.
>
> Hello, Timmy!
>
> How are you today?
>
> End of story
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the three provided Ink snippets and comparing their line-break output, focusing on the conditional assignment inside function say_hello. The work is done when assigning _helloTarget in that conditional produces the same intended line-break structure as the unconditional version while retaining the conditional names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100