Skip to content

Size by number

PHP switch + default

Same task in: TypeScript

Flowchart (ISO 5807)

YesNoYesNoStartInput nn = 0Return «нуль»Endn = 1Return «один»EndReturn «багато»EndFigure 1 — size

Source code

PHP
function size($n) {
    switch ($n) {
        case 0:
            return "нуль";
        case 1:
            return "один";
        default:
            return "багато";
    }
}

The editor opens with this code — change it and the chart redraws.

Language
PHP
Constructs
switch + default
Topic
Switch / case
Formats
Word, Visio, draw.io, PDF, SVG

Related examples