﻿ VARIABLE & STATEMENT CONDITIONS
TYL PROGRAMMING LANGUAGE
▶ VARIABLE & STATEMENT CONDITIONS
Variable & Statement Conditions
Variable condition statement is a condition statement that is composed of one scalar variable or value, and statement condition is any statement that yields a scalar variable.

The term statement is very fluid in Tyl semantics and even static values like 'X' or 1, are considered statements and have significance in some scenarios.
Boolean Interpretation of a Scalar Variable
Scalar Variable
Interpretation
if NULL or empty FALSE, otherwise TRUE
if equals to zero FALSE, otherwise TRUE
the boolean value itself
name 'Kazuo'
counter 0
sunishot \t
print 'name has value: ' + ( name ? \t \ \f )
print 'counter is not zero: ' + ( counter ? \t \ \f )
print 'sun is hot: ' + sunishot
name has value: true
counter is not zero: false
sun is hot: true
quantities 10 0 8
quantities 0 ? print 'First quantity is not zero' \ print 'First quantity is zero'
quantities 1 ? print 'Second quantity is not zero' \ print 'Second quantity is zero'
First quantity is not zero
Second quantity is zero
go:
istrue \t
istrue ? print 'istrue: ' + getmetrue \ print 'istrue: ' + getmefalse
istrue \f
istrue ? print 'istrue: ' + getmetrue \ print 'istrue: ' + getmefalse
getmetrue : \t
getmefalse : \f
istrue: true
istrue: false
It is good practise to use functions that act according to a boolean parameter:
go :
istrue \t
printstate istrue
printbystate istrue
istrue \f
printstate istrue
printbystate istrue
printstate state : print 'istrue: ' + state
printbystate state : state ? print 'The state is true.' \ print 'The state is false.'
istrue: true
The state is true.
istrue: false
The state is false.
Here's User Name Validator:
go:
print 'User name validated OK.'
print 'Continue with registration...'
\
print 'User name is not valid!'
^
validate name :
isvalid \f
name ? isvalid \t
isvalid
User name is not valid!
If we change the `username` assignment line to `username 'Timothy'`:
User name validated OK.
Continue with registration...
`validate` function can be shortened to:
validate name: name ? \t \ \f
PART 2
PART 4