ScripticXLearn programming visually
Platform
Problems
Community
Leaderboard
Learn
Docs
BasicsVariablesLoopsInput / Output
Examples
BasicsLoopsConditionsAlgorithms
What's newHelpContact
Loading…

Examples

MiniScript+

ExamplesMiniScript+
Fundamentals
Basic programsConditions
Programming patterns
LoopsAlgorithms
Examples/Loops

Loops

Counters, totals, countdowns, and repeated input implemented with MiniScript+ loops.

On this page
Count upwardSum from 1 to NCountdownProcess repeated input

Loops repeat the same operation while a condition holds or across a known interval.

Count upward#

MS+counter.mspMiniScript+
1counter = 02​3WHILE counter < 54  PRINT counter5  counter = counter + 16END

Sum from 1 to N#

MS+sum.mspMiniScript+
1n = 52total = 03​4FOR value = 1 TO n5  total = total + value6END7​8PRINT total

Countdown#

MS+countdown.mspMiniScript+
1counter = 52​3WHILE counter >= 04  PRINT counter5  counter = counter - 16END

Process repeated input#

MS+three-values.mspMiniScript+
1total = 02​3FOR index = 1 TO 34  INPUT value5  total = total + value6END7​8PRINT total

Every WHILE loop must make progress toward a false condition. Otherwise it will run indefinitely.

PreviousConditionsNextAlgorithms

On this page

Count upwardSum from 1 to NCountdownProcess repeated input