Variable names not allowed "?" and "!" but method name does - why?

We can write a method name as foo! or foo?; but not the same with
variable names. Like

foo? = 2

~> -:1: syntax error, unexpected ‘=’

~> foo? = 2

So why such design?

Am 30.06.2013 21:29, schrieb Love U Ruby:

We can write a method name as foo! or foo?; but not the same with
variable names. Like

foo? = 2

~> -:1: syntax error, unexpected ‘=’

~> foo? = 2

So why such design?

You are just using too few of them. See attached script, it works! :wink:

  • Matthias

“Matthias Wächter” [email protected] wrote in post #1114002:

You are just using too few of them. See attached script, it works! :wink:

  • Matthias

I understand only English :)… so the attached script is not helpful
for me :frowning:

Am 30.06.2013 22:07, schrieb Love U Ruby:

“Matthias Wächter” [email protected] wrote in post #1114002:

You are just using too few of them. See attached script, it works! :wink:

  • Matthias

I understand only English :)… so the attached script is not helpful
for me :frowning:

@Love U Ruby: ??? It’s only a couple of lines of code.

@Matthias: Why not include the code in the email?

“Matthias Wächter” [email protected] wrote in post #1114170:

Am 01.07.2013 16:54, schrieb [email protected]:

@Love U Ruby: ??? It’s only a couple of lines of code.

@Matthias: Why not include the code in the email?

Sorry … I wanted to make sure that the UTF-8 stuff is transported
without alteration of any kind.

I am getting error :-

-- encoding:utf-8 --

a?=5
p a?
b?=8
p b?
c?=false
p c?

Am 01.07.2013 16:54, schrieb [email protected]:

@Love U Ruby: ??? It’s only a couple of lines of code.

@Matthias: Why not include the code in the email?

Sorry … I wanted to make sure that the UTF-8 stuff is transported
without alteration of any kind.

#!/usr/bin/env ruby

-- encoding:utf-8 --

a‼=5
p a‼
b⁇=8
p b⁇
c⁉=false
p c⁉

  • Matthias