NOTE: This invite-only release of SunSed Alpha is for testing purposes and in no way represents the final quality of the product — join the waitlist (~wait time: 2 weeks). SunSed release date is on March 11, 2022.

CONTINUE

This statement is used to skip to the next iteration of any loops regardless of the remaining code in the current iteration. This is very handy when a specific condition is met halfway through an iteration and the current iteration requires no further processing, so we skip to the next iteration of the loop.

Example

The following code checks the status of each user to print the user's name, and if the user has an inactive status it will skip to the next user.

$users = [
    [
        "id" => "31294",
        "status" => "active",
        "name" => "Alex Garcia"
    ],
    [
        "id" => "90453",
        "status" => "inactive",
        "name" => "Alex Garcia"
    ],
    [
        "id" => "42271",
        "status" => "active",
        "name" => "Alex Garcia"
    ],
]

FOREACH ($users AS $user) {
    IF($user['active'] === 'inactive') {
        CONTINUE
    }
    :: $user['name']
}
Copyright © SunSed LLC 2013-2021 All rights reserved.