Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 687 Bytes

function-caller.md

File metadata and controls

42 lines (33 loc) · 687 Bytes
using System;

using BakedEnv.Environment;
using BakedEnv.Sources;

var function = new DelegateObject(delegate(object any) 
    { 
        Console.WriteLine(any.ToString()); 
    }
);

var environment = new BakedEnvironment();
environment.GlobalVariables["myFunc"] = function;

var source = new RawStringSource(Console.ReadLine()); 
// Assume the below example is the input
var session = environment.CreateSession(source);

session.Init();
session.ExecuteUntilTermination();

FunctionSample.cs

a = 500

myFunc("abc")
myFunc("trabajar")
myFunc(123 + 456)
myFunc(a * 0.5)

Example BakedEnv input

> abc
> trabajar
> 579
> 250

Expected output