tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
16
Task/Repeat-a-string/Euphoria/repeat-a-string-1.euphoria
Normal file
16
Task/Repeat-a-string/Euphoria/repeat-a-string-1.euphoria
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function repeat_string(object x, integer times)
|
||||
sequence out
|
||||
if atom(x) then
|
||||
return repeat(x,times)
|
||||
else
|
||||
out = ""
|
||||
for n = 1 to times do
|
||||
out &= x
|
||||
end for
|
||||
return out
|
||||
end if
|
||||
end function
|
||||
|
||||
puts(1,repeat_string("ha",5) & '\n') -- hahahahaha
|
||||
|
||||
puts(1,repeat_string('*',5) & '\n') -- *****
|
||||
4
Task/Repeat-a-string/Euphoria/repeat-a-string-2.euphoria
Normal file
4
Task/Repeat-a-string/Euphoria/repeat-a-string-2.euphoria
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- Here is an alternative method for "Repeat a string"
|
||||
include std/sequence.e
|
||||
printf(1,"Here is the repeated string: %s\n", {repeat_pattern("ha",5)})
|
||||
printf(1,"Here is another: %s\n", {repeat_pattern("*",5)})
|
||||
Loading…
Add table
Add a link
Reference in a new issue