JT 62e34b69b3
New commands: break, continue, return, and loop (#7230)
# Description

This adds `break`, `continue`, `return`, and `loop`.

* `break` - breaks out a loop
* `continue` - continues a loop at the next iteration
* `return` - early return from a function call
* `loop` - loop forever (until the loop hits a break)

Examples:
```
for i in 1..10 {
    if $i == 5 {
       continue
    } 
    print $i
}
```

```
for i in 1..10 {
    if $i == 5 {
        break
    } 
    print $i
}
```

```
def foo [x] {
    if true {
        return 2
    }
    $x
}
foo 100
```

```
loop { print "hello, forever" }
```

```
[1, 2, 3, 4, 5] | each {|x| 
    if $x > 3 { break }
    $x
}
```

# User-Facing Changes

Adds the above commands.

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
2022-11-25 09:39:16 +13:00
..
2022-10-20 23:28:18 +13:00
2022-08-11 11:54:54 -05:00
2022-11-22 16:58:11 -08:00
2022-09-11 11:48:27 +03:00
2022-10-14 21:51:44 +02:00
2022-02-07 14:54:06 -05:00
2022-11-05 07:38:39 +13:00
2022-02-07 14:54:06 -05:00
2022-09-01 08:32:56 +12:00
2022-02-07 14:54:06 -05:00
2022-09-05 16:41:06 +02:00
2022-11-21 17:04:36 +01:00
2022-02-17 06:40:24 -05:00
2022-02-07 14:54:06 -05:00
2022-09-11 11:48:27 +03:00
2022-02-16 12:24:45 -06:00
2022-05-18 20:47:26 -05:00
2022-07-04 06:31:50 +12:00
2022-02-07 14:54:06 -05:00
2022-11-11 19:51:08 +13:00
2022-02-07 14:54:06 -05:00
2022-11-22 16:58:11 -08:00
2022-05-13 06:47:11 -05:00
2022-09-11 11:48:27 +03:00
2022-09-11 11:48:27 +03:00
2022-11-10 10:57:44 +13:00
2022-02-07 14:54:06 -05:00
2022-11-09 17:06:47 -08:00
2022-02-07 14:54:06 -05:00
2022-02-07 14:54:06 -05:00
2022-09-28 13:48:34 +13:00
2022-11-22 16:58:11 -08:00
2022-03-24 16:42:41 +13:00
2022-11-12 07:21:45 +13:00
2022-02-22 11:32:29 -05:00
2022-09-11 11:48:27 +03:00