15Array
Consider the following example:
We would like to transform whileX
to use fat comma parameters. It does not seem to be possible to write something like whileY
.
But whileX
seems possible.
This means that as for now, virtual parameters must be of kind self-constrained.
See also workspace/CppEx.
tinyF: obj
condition-> BBB: var Boolean:
innerBool-> B: var Boolean: inner
...
BBB := innerBool
whileX (cond:< condition):repeat{doPart:< Object}:
loop: do
if (cond):then
doPart
restart(loop)
whileY{ cond -> BBB: var Boolean:< {innerBool-> B: var Boolean: inner{}; BBB := innerBool }}:repeat{exe:< Object}:
if (cond) :then
exe
restart(whileY)
@while:
in while:<
InnerBool: inner
out B: var Boolean
out BBB: var Boolean
BBB := innerBool
in repeat:< Object
loop: do
if (while) :then
repeat
restart(loop)
a: var char
"Start\n".print
a := 96
@while {a < 102} :repeat
a := a + 1
put(a)
whileX(a < 106):repeat
a := a + 1
put(a)