While Loop


Node Information
Runs the same procedure as long as the given value is TRUE.
WARINING: This might freeze your computer if the value does not change!
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Loop IN RUN MULTIPLE FALSE FALSE
Condition IN Boolean ONE FALSE FALSE
Body OUT RUN MULTIPLE FALSE FALSE
Complete OUT RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Loops
{
    [IsNode("While Loop")]
    public class WhileLoop : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Loop");
        Port condition = new Port(PortType.IN, typeof(bool), AcceptsLinks.ONE, "Condition");
        Port runout = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Body");
        Port complete = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Complete");
        public WhileLoop()
        {
            this.NodeType = KGraph.NodeType.Method;
            this.Name = "While Loop";
            AddPort(run);
            AddPort(condition);
            AddPort(runout);
            AddPort(complete);
            Information = "Runs the same procedure as long as the given value is TRUE.\r\n"
                        + "WARINING: This might freeze your computer if the value does not change!";
        }
        public override string Code()
        {
            return "while (" + GetValue(condition) + ")\r\n{\r\n" + GetValue(runout) + "}\r\n" + GetValue(complete);
        }
    }
}