Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 502 Bytes

examples.md

File metadata and controls

38 lines (34 loc) · 502 Bytes

I/O:

string name = input("What is your name?");
print("Hello ", name);

Looping:

int i;
for (i=1; i<=10; i++) {
  print("Loop ", i);
}

Functions, if statements:

is_prime := function(int num) bool {
  if num < 2 {
    return false;
  }
  int i;
  for (i=2; i<num; i++) {
    if num % i == 0 {
      return false;
    }
  }
  return true;
}

int num = input("Enter a number: ").to_int();
if is_prime(num) {
  print(num, " is prime.");
}
else {
  print(num, " is not prime.");
}