Skip to content

Pipe operator only works in specific order #14

Open

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

Activity

  1. added
    bugSomething isn't working
    on Mar 6, 2025
  2. Folyd commented on Mar 6, 2025

    @Folyd
    MemberAuthor
    let processed = "hello world" 
        |> str.trim()
        |> str.to_uppercase()
        |> str.replace("WORLD", "AISCRIPT");
    
    print(processed); // "HELLO AISCRIPT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglangAIScript Language Syntax

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions