Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationis_prime_number

is_prime_number (real value) ⇒ boolean

Checks if a number, value, is a prime number.

First available: Version 1.8.2

Notes

An example below use the is_prime_number function to calculate whether the first 100 numbers are prime or not.

YASS
for ($i = 0 to 100)
  print($i & " : " & is_prime_number($i) ? "Yes" : "No")
end for
  

The example below finds the first 100 prime numbers and uses a list to add the numbers to.

YASS
$l = []
$i = 2
while (list_get_length($l) < 100)
  $x = $i & " : " & is_prime_number($i) ? list_add_element($l, $i) : do_nothing()
  $i++
end while

print($l)
  
Comments

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you.

is_prime_number"/>

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.