Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -1,26 +1,11 @@
'using the IF/ELSEIF ladder
function fb( n )
if n mod 15 = 0 then
fb = "FizzBuzz"
elseif n mod 5 = 0 then
fb = "Fizz"
elseif n mod 3 = 0 then
fb = "Buzz"
else
fb = n
end if
end function
'the Mexican IF
function eef( b, p1, p2 )
if b then
eef = p1
else
eef = p2
end if
end function
'using the Mexican IF
function fb2( n )
fb2 = eef( n mod 15 = 0, "FizzBuzz", eef( n mod 5 = 0, "Fizz", eef( n mod 3 = 0, "Buzz", n ) ) )
end function
For i = 1 To 100
If i Mod 15 = 0 Then
WScript.Echo "FizzBuzz"
ElseIf i Mod 5 = 0 Then
WScript.Echo "Buzz"
ElseIf i Mod 3 = 0 Then
WScript.Echo "Fizz"
Else
WScript.Echo i
End If
Next

View file

@ -1,9 +1,7 @@
for i = 1 to 16
wscript.stdout.write fb(i) & " "
next
wscript.echo
for i = 1 to 16
wscript.stdout.write fb2(i) & " "
next
wscript.echo
With WScript.StdOut
For i = 1 To 100
If i Mod 3 = 0 Then .Write "Fizz"
If i Mod 5 = 0 Then .Write "Buzz"
If .Column = 1 Then .WriteLine i Else .WriteLine ""
Next
End With