I need help to concatenate 2 vars into 1 var, or any other method to use that vars together…
My intention is to make a art ascii generator where it needs to show a specific word to generate it… in this example i only will to show the word “a”, but i can’t, the print funciont prints the content of the var “([0,4])“, i need to concatenate the vars and process it like a command, not like a string… :
# encoding:utf-8
threexfive = '
# # ##
## ### ### ### ### # ###
# # # # # # # ## ### # #
### ### ### ### ### # ##
## ###
'
# The long of the letters a to f
threexfive_longs = '
a=[0,4]
b=[4,4]
c=[8,4]
d=[12,4]
e=[16,4]
f=[20,4]
'
string = ''
word = 'a'
word.each_char do |char|
$long = threexfive_longs.split(char).last.split(']').first.split('=').last + "]"
threexfive.each_line do |type|
# This don't works:
string = type + $long
print string
# But this works :(
# print type[20,4], type[0,4], type[8,4], type[16,4], "\n"
end
end
Here is the difference:
# This doesn't work:
string = type + $long
print string
Output:

# But this works :(
print type[0,4], "\n"
Output:

You can try to compose all the lines individually and then concatenate them with
join("\n")like in the following example. I strongly recommend using a proper data structure for the char positions (or “longs” as you called them). In this example, i have used a hash.the output of this program is: