Jump to content

Conditional structures: Difference between revisions

m
added debug/platform example
m (typo)
m (added debug/platform example)
Line 4,010:
In an iff() expression, only one of true_expr or false_expr will be evaluated, not both.
 
Phix has some rudimentary support of preprocessor ifdef statements, but their use is discouraged since
(since they are quite unnecessary in Phix, Ifor example in the following no code whatsoever is emitted for mightthe add).
first if statement, and in the second the conditions are evaluated at compile-time and code is only
emitted for one of the branches.
<lang Phix>constant DEBUG=false
if DEBUG then
puts(1,"debug is on\n")
end if
if platform()=WINDOWS then
puts(1,"this is windows\n")
elsif platform()=LINUX then
puts(1,"this is linux\n")
end if</lang>
 
===switch===
7,820

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.