C++ キーワード: continue
From cppreference.com
[編集] 使用法
-
continue文: 文の宣言として
[編集] 例
このコードを実行
#include <iostream> #include <string> [[nodiscard]] constexpr auto get_digits(const std::string& string) noexcept { std::string digits{}; for (const auto& character: string) { if (character < '0' || character > '9') [[likely]] continue; // conditionally skips the following statement digits += character; } return digits; } int main() noexcept { std::cout << get_digits("H3LL0, W0RLD!"); }
出力
300
[編集] 関連項目
|
(C++17以降) |
|
(C++23から) |
| (C++20以降) |