The Perl 6 language has a symbol to represent infinity (∞). Anyone have any 
ideas on how I can implement it in nim? Just for fun!

Use cases: 
    
    
    import math
    import strformat
    
    proc is_prime(n: int64): bool =
        for i in 2 .. n-1:
            if (n mod i) == 0:
                return false
        
        return if n != 1 and n != 0: true else: false
    
    for number in 1 .. ∞:
        if is_prime(number):
            echo &"{number} is prime number"
    
    
    Run

Loop from the beginning of the universe to the end of the universe (assuming 
the universe is infinite). 
    
    
    for age in -∞ .. ∞:
        echo if age < 0: "Before Christ" elif age == 0: "Year Zero" else: "Anno 
Domini"
    
    
    Run

Reply via email to