omdl  v0.9.8
OpenSCAD Mechanical Design Library
Scalar Operations

Operations for scalar data types. More...

+ Collaboration diagram for Scalar Operations:

Files

file  scalar_operate.scad
 Scalar data type operations.
 

Functions

function defined_or (v, d)
 Return given value, if defined, or a secondary value, if primary is not defined. More...
 
function boolean_or (v, d)
 Return given value, if it is Boolean, else return a secondary value, if not. More...
 
function number_or (v, d)
 Return given value, if it is a number, else return a secondary value, if not. More...
 
function string_or (v, d)
 Return given value, if it is a string, else return a secondary value, if not. More...
 
function list_or (v, d)
 Return given value, if it is a list, else return a secondary value, if not. More...
 
function index_c (i, l, f=0)
 Return a circular index position. More...
 

Detailed Description

Operations for scalar data types.

Requires:
include <omdl-base.scad>;

Validation Summary

filegroupscriptresultsno testskippedpassedfailedwarning
datatypes/scalar_operate.scadScalar OperationsScriptResults00800

No Failures

See complete validation results.

Function Documentation

◆ boolean_or()

function boolean_or ( ,
 
)

Return given value, if it is Boolean, else return a secondary value, if not.

Parameters
v<value> A primary value.
d<value> A secondary value.
Returns
<value> v when it is Boolean and d otherwise.

◆ defined_or()

function defined_or ( ,
 
)

Return given value, if defined, or a secondary value, if primary is not defined.

Parameters
v<value> A primary value.
d<value> A secondary value.
Returns
<value> v when it is defined and d otherwise.

The value d is returned only when v is equal to undef.

+ Here is the caller graph for this function:

◆ index_c()

function index_c ( ,
,
= 0 
)

Return a circular index position.

Parameters
i<integer> A integer position.
l<integer> The range length.
f<integer> The starting index position.
Returns
<integer> The index position mapped into a circular list within the range [f : l+f-1].

◆ list_or()

function list_or ( ,
 
)

Return given value, if it is a list, else return a secondary value, if not.

Parameters
v<value> A primary value.
d<value> A secondary value.
Returns
<value> v when it is a list and d otherwise.

◆ number_or()

function number_or ( ,
 
)

Return given value, if it is a number, else return a secondary value, if not.

Parameters
v<value> A primary value.
d<value> A secondary value.
Returns
<value> v when it is a number and d otherwise.

◆ string_or()

function string_or ( ,
 
)

Return given value, if it is a string, else return a secondary value, if not.

Parameters
v<value> A primary value.
d<value> A secondary value.
Returns
<value> v when it is a string and d otherwise.