Created
December 10, 2013 14:18
-
-
Save yutopp/7891263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): int | |
{ | |
print( "hello, bunchou lang on Linux!!!bunbun!\n" ); | |
val i = 1: int mutable; | |
while( i < 100 ) { | |
if ( i % 15 == 0 ) { | |
print( "Fizzbuzz " ); | |
} else if ( i % 5 == 0 ) { | |
print( "Buzz " ); | |
} else if ( i % 3 == 0 ) { | |
print( "Fizz " ); | |
} else { | |
extern_print_int( i ); print( " " ); | |
} | |
i = i + 1; | |
} | |
print( "\n" ); | |
// Test | |
overload( 2, 5 ); | |
overload( "bun!" ); | |
return 0; | |
} | |
def overload( val a: int, val b: int ): void | |
{ | |
print( "====================\n" ); | |
print( "test_scope\n" ); | |
print( "====================\n" ); | |
val i = 42: int mutable; | |
{ | |
val i = 72: int; | |
print( "inner: " ); print_int( i ); | |
} | |
print( "outer: " ); print_int( i ); | |
} | |
def overload( ref s: string ): void | |
{ | |
print( "====================\n" ); | |
print( s ); | |
print( "\n" ); | |
} | |
// | |
extern def extern_print_int( val :int ): void "put_string2"; | |
def print_int( val i: int ): int { extern_print_int( i ); print( "\n" ); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment