Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
7
Task/Loops-Do-while/Clipper/loops-do-while.clipper
Normal file
7
Task/Loops-Do-while/Clipper/loops-do-while.clipper
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Local n := 0
|
||||
DO WHILE .T.
|
||||
? ++n
|
||||
IF n % 6 == 0
|
||||
EXIT
|
||||
ENDIF
|
||||
ENDDO
|
||||
5
Task/Loops-Do-while/GAP/loops-do-while.gap
Normal file
5
Task/Loops-Do-while/GAP/loops-do-while.gap
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
n := 0;
|
||||
repeat
|
||||
n := n + 1;
|
||||
Print(n, "\n");
|
||||
until RemInt(n, 6) = 0;
|
||||
8
Task/Loops-Do-while/Scala/loops-do-while-1.scala
Normal file
8
Task/Loops-Do-while/Scala/loops-do-while-1.scala
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
var (x, l) = (0, List[Int]())
|
||||
do {
|
||||
x += 1
|
||||
l :+= x // A new copy of this list with List(x) appended.
|
||||
} while (x % 6 != 0)
|
||||
l
|
||||
}.foreach(println(_))
|
||||
6
Task/Loops-Do-while/Scala/loops-do-while-2.scala
Normal file
6
Task/Loops-Do-while/Scala/loops-do-while-2.scala
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def loop(iter: Int, cond: (Int) => Boolean, accu: List[Int]): List[Int] = {
|
||||
val succ = iter + 1
|
||||
val temp = accu :+ succ
|
||||
if (cond(succ)) loop(succ, cond, temp) else temp
|
||||
}
|
||||
println(loop(0, (_ % 6 != 0), Nil))
|
||||
5
Task/Loops-Do-while/Scala/loops-do-while-3.scala
Normal file
5
Task/Loops-Do-while/Scala/loops-do-while-3.scala
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def loop(i: Int, cond: (Int) => Boolean): Stream[Int] = {
|
||||
val succ = i + 1;
|
||||
succ #:: (if (cond(succ)) loop(succ, cond) else Stream.empty)
|
||||
}
|
||||
loop(0, (_ % 6 != 0)).foreach(println(_))
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
var x=0
|
||||
do {
|
||||
println(x)
|
||||
x+=1
|
||||
} while(x%6!=0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue