A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
13
Task/Boolean-values/GAP/boolean-values.gap
Normal file
13
Task/Boolean-values/GAP/boolean-values.gap
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
1 < 2;
|
||||
# true
|
||||
|
||||
2 < 1;
|
||||
# false
|
||||
|
||||
# GAP has also the value fail, which cannot be used as a boolean but may be used i$
|
||||
|
||||
1 = fail;
|
||||
# false
|
||||
|
||||
fail = fail;
|
||||
# true
|
||||
1
Task/Boolean-values/Inform-7/boolean-values-1.inf
Normal file
1
Task/Boolean-values/Inform-7/boolean-values-1.inf
Normal file
|
|
@ -0,0 +1 @@
|
|||
let B be whether or not 123 is greater than 100;
|
||||
1
Task/Boolean-values/Inform-7/boolean-values-2.inf
Normal file
1
Task/Boolean-values/Inform-7/boolean-values-2.inf
Normal file
|
|
@ -0,0 +1 @@
|
|||
if B is true, say "123 is greater than 100."
|
||||
9
Task/Boolean-values/Inform-7/boolean-values-3.inf
Normal file
9
Task/Boolean-values/Inform-7/boolean-values-3.inf
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
To decide whether the CPU is working correctly:
|
||||
if 123 is greater than 100, decide yes;
|
||||
otherwise decide no.
|
||||
|
||||
When play begins:
|
||||
[convert to truth state...]
|
||||
let B be whether or not the CPU is working correctly;
|
||||
[...or use as a condition]
|
||||
if the CPU is working correctly, say "Whew."
|
||||
4
Task/Boolean-values/Julia/boolean-values.julia
Normal file
4
Task/Boolean-values/Julia/boolean-values.julia
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#Boolean and conditional expressions only accept 'true' or 'false'
|
||||
|
||||
#Convert a number or numeric array to boolean
|
||||
bool(x)
|
||||
4
Task/Boolean-values/Logo/boolean-values-1.logo
Normal file
4
Task/Boolean-values/Logo/boolean-values-1.logo
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
print 1 < 0 ; false
|
||||
print 1 > 0 ; true
|
||||
if "true [print "yes] ; yes
|
||||
if not "false [print "no] ; no
|
||||
3
Task/Boolean-values/Logo/boolean-values-2.logo
Normal file
3
Task/Boolean-values/Logo/boolean-values-2.logo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if equal? 0 ln 1 [print "zero]
|
||||
if empty? [] [print "empty] ; empty list
|
||||
if empty? "|| [print "empty] ; empty word
|
||||
11
Task/Boolean-values/Maxima/boolean-values.maxima
Normal file
11
Task/Boolean-values/Maxima/boolean-values.maxima
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
is(1 < 2);
|
||||
/* true */
|
||||
|
||||
is(2 < 1);
|
||||
/* false */
|
||||
|
||||
not true;
|
||||
/* false */
|
||||
|
||||
not false;
|
||||
/* true */
|
||||
28
Task/Boolean-values/Mirah/boolean-values.mirah
Normal file
28
Task/Boolean-values/Mirah/boolean-values.mirah
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
|
||||
# booleans
|
||||
puts 'true is true' if true
|
||||
puts 'false is false' if (!false)
|
||||
|
||||
# lists treated as booleans
|
||||
x = ArrayList.new
|
||||
puts "empty array is true" if x
|
||||
x.add("an element")
|
||||
puts "full array is true" if x
|
||||
puts "isEmpty() is false" if !x.isEmpty()
|
||||
|
||||
# maps treated as booleans
|
||||
map = HashMap.new
|
||||
puts "empty map is true" if map
|
||||
map.put('a', '1')
|
||||
puts "full map is true" if map
|
||||
puts "size() is 0 is false" if !(map.size() == 0)
|
||||
|
||||
# these things do not compile
|
||||
# value = nil # ==> cannot assign nil to Boolean value
|
||||
# puts 'nil is false' if false == nil # ==> cannot compare boolean to nil
|
||||
# puts '0 is false' if (0 == false) # ==> cannot compare int to false
|
||||
|
||||
#puts 'TRUE is true' if TRUE # ==> TRUE does not exist
|
||||
#puts 'FALSE is false' if !FALSE # ==> FALSE does not exist
|
||||
17
Task/Boolean-values/Modula-2/boolean-values.mod2
Normal file
17
Task/Boolean-values/Modula-2/boolean-values.mod2
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
MODULE boo;
|
||||
|
||||
IMPORT InOut;
|
||||
|
||||
VAR result, done : BOOLEAN;
|
||||
A, B : INTEGER;
|
||||
|
||||
BEGIN
|
||||
result := (1 = 2);
|
||||
result := NOT result;
|
||||
done := FALSE;
|
||||
REPEAT
|
||||
InOut.ReadInt (A);
|
||||
InOut.ReadInt (B);
|
||||
done := A > B
|
||||
UNTIL done
|
||||
END boo.
|
||||
1
Task/Boolean-values/Modula-3/boolean-values.mod3
Normal file
1
Task/Boolean-values/Modula-3/boolean-values.mod3
Normal file
|
|
@ -0,0 +1 @@
|
|||
TYPE BOOLEAN = {FALSE, TRUE}
|
||||
Loading…
Add table
Add a link
Reference in a new issue