8000 [BUG]: Conditional expression results in a bool type (inconsistent with python) · Issue #1767 · modular/modular · GitHub
[go: up one dir, main page]

Skip to content
[BUG]: Conditional expression results in a bool type (inconsistent with python) #1767
@davidbrownell

Description

@davidbrownell

Bug description

The following code in Mojo prints True:

fn main():
    let x = 0
    print(x or "hello")

In python, the following code prints hello:

print(0 or "hello")

Steps to reproduce

  • Build the provided code in mojo and python to see the differences in behavior.

System information

- What OS did you install Mojo on? 
Ubuntu 22.04

- Provide version information for Mojo by pasting the output of `mojo -v`?
mojo 0.7.0 (af002202)

- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.4.1 (2d8afe15)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmojoIssues that are related to mojomojo-repoTag all issues with this label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0