Set
Set varName valueAssign a value to a variable. Value can be a literal, variable, or expression.
Set x 42
Set y ADD(x, 10)IPCI — the Introductory Programming Concept Illustrator — is a small teaching language for learning programming fundamentals. Programs are written as a plain sequence of statements, and the browser-based editor runs them one step at a time so you can watch each variable change as it happens. This page documents the whole language: its three data types, its statements, its control flow, and every operator.
Every variable is declared with its type before use. IPCI has three.
| Keyword | Holds | Declaration |
|---|---|---|
Integer | Whole number | Integer count |
String | Text value | String name |
Boolean | TRUE or FALSE | Boolean flag |
Set varName valueAssign a value to a variable. Value can be a literal, variable, or expression.
Set x 42
Set y ADD(x, 10)Accept varNamePrompt the user for input and store it in the variable.
Accept ageDisplay expr...Output text. Use "quotes" for strings, [brackets] for variables, or bare names.
Display "Hello " [name] "!"Run one branch or the other depending on whether a condition holds.
IF GT(x, 5)
Display "x is big"
Else
Display "x is small"
EndIFTest conditions in order and run the first branch that holds. A chain has one EndIF, however many ElseIF branches it contains.
IF GE(score, 70)
Display "A"
ElseIF GE(score, 60)
Display "B"
Else
Display "F"
EndIFRepeat a block for as long as a condition stays true.
While LT(i, 10)
Display i
Set i ADD(i, 1)
EndWhileDefine a reusable calculation. A function declares a return type and must return a value, so it can be used anywhere an expression can.
Function Integer Area(Integer w, Integer h)
Integer result
Set result MUL(w, h)
Return result
EndFunction
Integer a
Set a Area(3, 4)Define a reusable action. A procedure returns nothing, so it is run with Call rather than used in an expression.
Procedure Greet(String name)
Display "Hello, " [name] "!"
EndProcedure
Call Greet("Saint")Send a value back to the caller and exit the function immediately, even from inside a loop or an IF. A procedure may use Return on its own to exit early.
Function Integer Bigger(Integer a, Integer b)
IF GT(a, b)
Return a
EndIF
Return b
EndFunctionComparisons are written as calls rather than symbols. They are what an IF or While tests.
Division is integer division. Operators nest, so an expression can be built out of other expressions:
Set x ADD(MUL(2,3),4)Logical operators take two conditions separated by a pipe. Note that NOT is an exclusive or — it is true when exactly one of its two conditions holds.
IF AND(GT(a,0)|LT(b,100))
Display "Both true"
EndIFShortcuts available in the editor.
Comments
Anything after
//is ignored by the interpreter.