Skip to content

Pipe operator only works in specific order #14

@Folyd

Description

@Folyd

cannot convert to string, the value is HELLO WORLD.

fn to_uppercase(text: str) -> str {
    return text.to_uppercase();
}

fn remove_spaces(text: str) -> str {
    return text.replace(" ", "");
}

fn count_chars(text: str) -> int {
    return len(text);
}

let result = "Hello World" 
    |> to_uppercase      // "HELLO WORLD"
    |> remove_spaces     // "HELLOWORLD"
    |> count_chars;      // 10

print(result); // 10

However, this works:

let result = "Hello World" 
    |> remove_spaces     // "HELLOWORLD"
    |> to_uppercase      // "HELLO WORLD"
    |> count_chars;      // 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglangAIScript Language Syntax

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions