T
Tuka Opaleye
Hi,
I am trying to get my head around the || symbol used extensively in
ruby. To me it is somewhat foreign still and I am trying a few exercise
to make it click. Can anyone suggest a phrase (pseudolanguage) that
accurately expresses the possible expressions using || ?
For example, see the comments and please correct me if I am wrong. Could
you add other cases that I may not have caught here ?
input.each_byte do |b|
case b
when ?\C-c; puts 'Control-C: stopped a process?'
when ?\C-z; puts 'Control-Z: suspended a process?'
when ?\n; puts 'Newline.'
when ?\M-x; puts 'Meta-x: using Emacs?'
end
for each byte in input, assign it to b...
Ex 2:
open('smiley.html', 'wb') do |f|
f << '<meta http-equiv="Content-Type"
content="text/html;charset=UTF-8">'
f << "\xe2\x98\xBA"
end
Sugestions ?.....
Ex 3:
octal = "\000\001\010\020"
octal.each_byte { |x| puts x }
for each byte in octal, assign an x...
TIA,
Tuka
I am trying to get my head around the || symbol used extensively in
ruby. To me it is somewhat foreign still and I am trying a few exercise
to make it click. Can anyone suggest a phrase (pseudolanguage) that
accurately expresses the possible expressions using || ?
For example, see the comments and please correct me if I am wrong. Could
you add other cases that I may not have caught here ?
input.each_byte do |b|
case b
when ?\C-c; puts 'Control-C: stopped a process?'
when ?\C-z; puts 'Control-Z: suspended a process?'
when ?\n; puts 'Newline.'
when ?\M-x; puts 'Meta-x: using Emacs?'
end
for each byte in input, assign it to b...
Ex 2:
open('smiley.html', 'wb') do |f|
f << '<meta http-equiv="Content-Type"
content="text/html;charset=UTF-8">'
f << "\xe2\x98\xBA"
end
Sugestions ?.....
Ex 3:
octal = "\000\001\010\020"
octal.each_byte { |x| puts x }
for each byte in octal, assign an x...
TIA,
Tuka