Module:Sandbox4

local p = {} function p.arithmetic local a = 3 local b = 2 local result result = ';Arithmetic\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a + b is ' .. a + b .. '\n' result = result .. ':a - b is ' .. a - b .. '\n' result = result .. ':a * b is ' .. a * b .. '\n' result = result .. ':a / b is ' .. a / b .. '\n' result = result .. ':a % b is ' .. a % b .. '\n' result = result .. ':a ^ b is ' .. a ^ b .. '\n' result = result .. ':-a is ' .. -a .. '\n' return result end function p.relational local a = 3 local b = 2 local result result = ';Relational\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a == b is ' .. tostring(a == b) .. '\n' result = result .. ':a ~= b is ' .. tostring(a ~= b) .. '\n' result = result .. ':a < b is ' .. tostring(a < b) .. '\n' result = result .. ':a > b is ' .. tostring(a > b) .. '\n' result = result .. ':a <= b is ' .. tostring(a <= b) .. '\n' result = result .. ':a >= b is ' .. tostring(a >= b) .. '\n' return result end function p.logical local a = 3 local b = 2 local result result = ';Logical\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a < b and b < a is ' .. tostring(a < b and b < a) .. '\n' result = result .. ':a < b or b < a is ' .. tostring(a < b or b < a) .. '\n' result = result .. ':a < b is ' .. tostring(a < b) .. '\n' result = result .. ':not (a < b) is ' .. tostring(not (a < b)) .. '\n' return result end function p.length local string = 'This is a string' local result result = ';Length\n' result = result .. ':The length of "' .. string .. '" is ' .. #string return result end return p