pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Math

Example

Simple logical operations and variable assignment

API

date = 10
  • Add a constant
date = 11 + 12
  • Perform addition/subtraction/multiplication/division/modulus/exponentiation operations on both sides of the equation
date = 13 + 4 - 8 % 2 - 7
  • Perform addition/subtraction/multiplication/division/modulus/exponentiation operations on two or more values
date = 5 & 6
  • Bitwise operation
date = math.pi
  • Assign the constant value of π
date = 9 % 2
  • Modulus operation
date = 8 % 2 == 0
  • Detect a data value. even/old/prime/whole/positive/negative/divisible by
date = sum(list1)
  • Array operation function
date = random.random()
  • Output a random floating-point number between 0 and 1
date = random.randint(0, 10)
  • Output a random number within a specific range
date = min(max(50, 1), 100)
  • Limit the range of a data value
date = math.remap(0, 0, 1023, 0, 255)
  • Value mapping
date = round(2.4)
  • Round a number using the round() function
date = math.sqrt(0)
  • Apply mathematical functions to a numeric value. sqrt()/log()/log10()/exp()/pow()
date = math.sin(10 / 180.0 * math.pi)
  • Trigonometric functions. sin()/cos()/tan()/asin()/acos()/atan()
date = int('8')
  • Convert the data type to int
date = float('0.8')
  • Convert the data type to float
date = ((10 >> 0) & 0x01)
  • Clear a specific bit in a data value
date = (10 | (0x01 << 0))
  • Get a specific bit in a data value
date = (10 & (~ (0x01 << 0)))
  • Modify a specific bit in a data value
date = int.from_bytes(10, 'big')
  • Flip the least significant bit of a given value
date = (10 ^ (0x01 << 0))
  • Convert a byte sequence to an integer
On This Page