Loops/Increment loop index within loop body: Difference between revisions

Content added Content deleted
No edit summary
m (→‎{{header|R}}: Syntax highlighting.)
Line 3,924: Line 3,924:
=={{header|R}}==
=={{header|R}}==
R cannot complete this task with a for loop. See https://stackoverflow.com/a/5913329/ . Instead, we must go down the same path as the Kotlin solution. Because it is sufficient for numbers this small, we will save ourselves some work and use the gmp library's isprime function for checking if a number is prime.
R cannot complete this task with a for loop. See https://stackoverflow.com/a/5913329/ . Instead, we must go down the same path as the Kotlin solution. Because it is sufficient for numbers this small, we will save ourselves some work and use the gmp library's isprime function for checking if a number is prime.
<lang R>i<-42
<lang rsplus>i<-42
primeCount<-0
primeCount<-0
while(primeCount<42)
while(primeCount<42)