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

Documentation: wrong example for BREAK #469

Closed
2 tasks done
kotolex opened this issue Apr 11, 2024 · 1 comment · Fixed by #483
Closed
2 tasks done

Documentation: wrong example for BREAK #469

kotolex opened this issue Apr 11, 2024 · 1 comment · Fixed by #483
Labels
documentation Improvements or additions to documentation

Comments

@kotolex
Copy link
Contributor

kotolex commented Apr 11, 2024

Description

here https://surrealdb.com/docs/surrealdb/surrealql/statements/break is a wrong example, it do nothing cause break on first value (1 is less than 2)

My suggestion:
`
-- Create a person for everyone in the array where the number is lower than or equal to 5
LET $num = [1,2,3,4,5,6,7,8,9];

FOR $thing IN $num {
IF $thing > 5 {
BREAK;
};
CREATE type::thing(
'person', $thing
) CONTENT {
name: $thing
};
};
`

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kotolex kotolex added the documentation Improvements or additions to documentation label Apr 11, 2024
@Ekwuno
Copy link
Contributor

Ekwuno commented Apr 17, 2024

-- Create a person for everyone in the array where the number is lower than or equal to 5
LET $num = [1,2,3,4,5,6,7,8,9];

FOR $thing IN $num {
    IF $thing > 5{
        BREAK;
 
    } ELSE IF $thing < 5 {
        CREATE type::thing(
            'person', $thing
        ) CONTENT {
            name: $thing 
        };
 
    };
 
};

Screenshot 2024-04-17 at 16 33 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants