apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

foreach loops #140

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Implement basic foreach() loops for iterating over a range or container. Should 
support the use of generators and numeric ranges, when available.

entrypoint :
{
    foreach(integer x in [100..2])
    {
        print(cast(string, x) ; " bottles of beer on the wall...")
    }

    print("Uh oh! Low on beer!")
}

Original issue reported on code.google.com by don.ap...@gmail.com on 15 Feb 2012 at 8:33

GoogleCodeExporter commented 9 years ago
hmmm.... personally i prefer just combining for and foreach into one generic 
"for"

entrypoint:
{
    for(var x in [1...100])
    {
        print(cast(string, x));
    }
}

Original comment by ryoohki@gmail.com on 15 Feb 2012 at 8:42