Code Blocks

Introduction

All programming languages have language specific syntaxes. code blocks are language agnostic blocks which Nungu Code uses to generate language specific code like the one below.

This document provides a high-level overview about code blocks in Nungu Code and how they translate into generated code. The following code blocks are available under the Basic Blocks section in Library Manager.

How do they look?

Image

Arrow Types

Image

Input/Output arrow

This arrow is used to indicate the input and output of the code block.

Trigger arrow

This arrow is present in a code block if the code block is triggered using a external condition. Logic in the code block will be executed if the trigger is set to TRUE.

Nested arrow

This arrow is used when a conditional statement needs nesting like, else if.

Source arrow

This is a special arrow which is used in conjunction with Oriented Oriented Programming (OOP). This arrow is used to specify the object of the class class to be used.

Code Blocks

Constant Block

This is a constant input block. The block takes in all constant values including arrays.

Display Block

This block is used to visualise the output of the value in the connector. No special care is required to handle datatypes. This block should work with all basic types, list and array.

Function Block

This block is used to group logic which implements a function together.

If Block

This is a conditional block which is executed only when the trigger of the block becomes TRUE. Double click this block to implement the required functionality.

This block has nest input & output for,

  1. implementing nested else if conditions
  2. mapping else conditions to the respective if condition.

Else Block

This is the default execution block if the trigger to the if condition attached to it fails.

For Block

While Block

This is a loop block. Functionality inside this block is executed till the trigger attached to becomes FALSE.

Block properties

Each block has a list of modifiable properties. Right click → Properties will open the block property editor.

So block will also open the property editor when double clicked.

Pass value externally

Most block properties are generally set in the block property editor. Enable this flag if you wish to expose this property as an input.

Nungu © 2023.