September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,6 @@
|
|||
switch {condition1,condition2} do
|
||||
case {true,true}:
|
||||
case {true,false}:
|
||||
case {false,true}:
|
||||
case {false,false}:
|
||||
end switch
|
||||
10
Task/Extend-your-language/Phix/extend-your-language-2.phix
Normal file
10
Task/Extend-your-language/Phix/extend-your-language-2.phix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function if2(bool c1, bool c2)
|
||||
return c1*10+c2
|
||||
end function
|
||||
|
||||
switch if2(condition1,condition2) do
|
||||
case 11:
|
||||
case 10:
|
||||
case 01:
|
||||
case 00:
|
||||
end switch
|
||||
12
Task/Extend-your-language/Phix/extend-your-language-3.phix
Normal file
12
Task/Extend-your-language/Phix/extend-your-language-3.phix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
enum BOTH = 0b11, FIRST = 0b10, SECOND = 0b01, NEITHER = 0b00
|
||||
|
||||
function if2(bool c1, bool c2)
|
||||
return c1*2+c2
|
||||
end function
|
||||
|
||||
integer r = if2(condition1,condition2)
|
||||
if r=BOTH then
|
||||
elsif r=FIRST then
|
||||
elsif r=SECOND then
|
||||
elsif r=NEITHER then
|
||||
end if
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
global constant T_if2 = 5200 tt_stringF("if2",T_if2)
|
||||
global constant T_else1 = 5200 tt_stringF("else1",T_else1)
|
||||
global constant T_else2 = 5200 tt_stringF("else2",T_else2)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
--constant T_endelseelsif = {T_end,T_else,T_elsif,T_case,T_default,T_fallthru,T_fallthrough}
|
||||
constant T_endelseelsif = {T_end,T_else,T_else1,T_else2,T_elsif,T_case,T_default,T_fallthru,T_fallthrough}
|
||||
|
|
@ -0,0 +1 @@
|
|||
elsif ttidx=T_if2 then DoIf2()
|
||||
12
Task/Extend-your-language/Phix/extend-your-language-7.phix
Normal file
12
Task/Extend-your-language/Phix/extend-your-language-7.phix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
for N=10 to 20 do
|
||||
printf(1,"%d is ",N)
|
||||
if2 mod(N,2)=0, mod(N,3)=0 then
|
||||
puts(1,"divisible by both two and three.\n")
|
||||
else1
|
||||
puts(1,"divisible by two, but not by three.\n")
|
||||
else2
|
||||
puts(1,"divisible by three, but not by two.\n")
|
||||
else
|
||||
puts(1,"neither divisible by two, nor by three.\n")
|
||||
end if2
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue