Hi, im learning ruby and hear the terms variable and string used quite frequently, how exactly do they correlate with each other? And what are their definitions? because i have done my research but it would be easier to understand if someone was to put it in layman's terms

A string is just text... or, a short snippet of text. It can be any single character or string (ha... ha... -_-) of characters. What makes a string a string is that it responds to String-commands.

"3" can be a string, because you can tell it to do string things, whereas 3 is an integer because it responds to the methods that integers respond to. The difference in how they're typed ("3" vs 3) can be a kind of guide post for whether a number is a string or an integer.

A string (as well as an integer) is a type of data. And by type of data I just mean that it responds to a certain set of messages. You can ask a string how many characters it has. You can ask it to reverse itself. You can ask it to capitalize its letters or split itself in half.

You can create a string in Ruby in a few different ways. But the most illustrative method of creating a string is with a literal, which is just using quote marks. Whatever you put in your quote marks is a string.

"I am a string."

A variable is something that holds something else. If you're familiar with algebra it should be relatively easy to think of a variable in Ruby has being the same thing as a variable in algebra.

In x = 2 + 2, x is the variable. x now holds the value of 2 + 2, so instead of typing '4' or '2 + 2' in order to access that value, you can just type x. This is incredibly useful when the values you're holding on to change, or when you set them in one part of a program and need to use them again in another.

You can set a variable to equal a string (or... pretty much anything else in Ruby, including another variable).

this_variable = "a string"

Now every time you type this_variable in your program, the program will return "a string."

If you do your research and you're still confused, crack open IRB and play around. Copy what the tutorials say, try variations on what they say. Don't be afraid of error messages - copying and pasting them into Google will often help a great deal.

Do you have any more specific questions about strings or variables? Did this help any?