Documentations - SRON
  • SRON's Official Documentation
  • Installation
  • Syntax of SRON
  • Executing a SRON code
  • Keywords in SRON
  • Comments in SRON
  • Datatypes in SRON
  • Variables in SRON
  • Memory Ownership Model
  • Operators in SRON
  • Math block
  • if elif else in SRON
  • Loops in SRON
    • For Loop
    • While Loop
    • Foreach Loop
  • Break & Continue
  • Functions in SRON
    • Print functions
    • User Input Functions
    • Type Conversion functions
    • Type Checking functions
    • Math functions
    • Char Functions
    • String Functions
    • List Functions
    • Miscellaneous functions
  • Return in SRON
  • Command Line Arguments
  • Free
  • Rotate
  • Console
  • Sample codes
  • Coding Convention
  • Frequently Asked Questions
  • Credits
  • Contact
  • Donate
Powered by GitBook
On this page
  • To solve a mathematical and logical expression, SRON provides the Math block operators '{ }'. All you have to do is to put them on the left and right side of your expression.
  • NOTE : You cannot use assignment operator (=, += ...) inside Math block, otherwise it will throw an compile time error.

Math block

To solve a mathematical and logical expression, SRON provides the Math block operators '{ }'. All you have to do is to put them on the left and right side of your expression.

- Here is a sample code to add two numbers using '+' operator.

{
    name : MAIN
    println(~{ 2+2 }~)

    variables : String x = "Hello", String y= " World!"

    println(~{ x+y }~)
}

Output:

4 Hello World!


- Here is a sample code to check if two integers are equal or not.

{
    name : MAIN
    Int a = 10, Int b = 20

    println(~{ a == b }~)
    println(~{ a != b }~)
}

Output:

false true


NOTE : You cannot use assignment operator (=, += ...) inside Math block, otherwise it will throw an compile time error.

PreviousOperators in SRONNextif elif else in SRON

Last updated 6 months ago

You can use all Arithmetic, logical and comparison operators mentioned inside Math block.

here