mirror of
https://onedev.site.tesses.net/crosslang/crosslang-tutorials
synced 2026-02-09 01:25:47 +00:00
First commit
This commit is contained in:
35
1 Our first project/src/main.tcross
Normal file
35
1 Our first project/src/main.tcross
Normal file
@@ -0,0 +1,35 @@
|
||||
func aFunctionWithOptionalArgument(a,$b)
|
||||
{
|
||||
Console.WriteLine(a);
|
||||
|
||||
if(TypeIsDefined(b))
|
||||
{
|
||||
Console.WriteLine(b);
|
||||
}
|
||||
else {
|
||||
Console.WriteLine("B is not defined");
|
||||
}
|
||||
}
|
||||
|
||||
func String.Join(join, $$strings)
|
||||
{
|
||||
var first=true
|
||||
var output = "";
|
||||
each(var item : strings)
|
||||
{
|
||||
if(!first)
|
||||
output +=join;
|
||||
first=false;
|
||||
output += item;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
func main(args)
|
||||
{
|
||||
//aFunctionWithOptionalArgument("A string");
|
||||
//aFunctionWithOptionalArgument(true, 42);
|
||||
|
||||
|
||||
Console.WriteLine(String.Join(".","192","168","0","142"));
|
||||
}
|
||||
Reference in New Issue
Block a user