ScripticXLearn programming visually
Platform
Problems
Community
Leaderboard
Learn
Docs
MiniScript+ basicsVariablesOperators and expressionsInput and outputConditions and decisionsLoopsStringsSums, counts, and extremaDigits of a numberDivisibility and prime numbersNumeric sequences and recurrencesNumber basesFunctions and parametersRecursion
Examples
Basic programsConditionsInput and outputLoopsAlgorithmsWorking with textDigit problemsBase conversionsFunctions and recursionEncode text with a key
What's newHelpContact
Loading…

Examples

MiniScript+

ExamplesMiniScript+
Fundamentals
Basic programsConditionsInput and output
Programming patterns
LoopsAlgorithmsWorking with textDigit problemsBase conversionsFunctions and recursionEncode text with a key
Examples/Input and output

Input and output

Interactive programs with numbers, text identifiers, and validation.

On this page
Rectangle area and perimeterPreserve leading zeros in an identifierTry it

Each INPUT waits for one complete value. Submit numbers separately rather than on the same line. Read the input/output lesson first.

Rectangle area and perimeter#

MS+MiniScript+
1INPUT length2INPUT width3IF length > 0 AND width > 0 THEN4  PRINT length * width5  PRINT 2 * (length + width)6ELSE7  PRINT "Invalid sides"8END

Submit 6, then 4. The program prints 24 and 20 on separate lines. Inputs 0 and 4 produce Invalid sides. Validation comes first because this problem requires strictly positive sides.

Preserve leading zeros in an identifier#

MS+MiniScript+
1INPUT identifier2PRINT identifier3PRINT LEN(identifier)

Enter "0007", including JSON quotes, in the editor console. The output is string 0007, then number 4. Without quotes the console interprets 0007 as a number; LEN requires text and raises an error. Problem test cases should carry a typed string without extra quote characters in its contents.

Try it#

Test the rectangle with 1 and 1, then a negative side. Test an empty identifier "" too. A submitted solution should print only the required results, without extra input prompts.

PreviousConditionsNextLoops

On this page

Rectangle area and perimeterPreserve leading zeros in an identifierTry it