Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform if statements inside class #497

Open
Akuli opened this issue Feb 19, 2024 · 0 comments
Open

Platform if statements inside class #497

Akuli opened this issue Feb 19, 2024 · 0 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Feb 19, 2024

I want to put if WINDOWS inside class to create windows specific method, useful when method only needed on one platform.

import "stdlib/io.jou"

class Foo:
    def bar(self) -> None:
        printf("bar\n")
        if WINDOWS:
            self->do_windows_thing()

    if WINDOWS:  # <---- Error :(
        def do_windows_thing(self) -> None:
            printf("lol\n")


def main() -> int:
    f = Foo{}
    f.bar()
    return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant