Variable Lesson
Author |
Message |
upthescale
|
Posted: Tue Mar 21, 2006 9:45 pm Post subject: Variable Lesson |
|
|
Here yeah go:
code: |
% This lesson will teach you about variables.
%A variable is to be declared, so you can use it through out the program.
%here is an example:
var age:int %This is age is the variable...since you are asking for an
%Age, you are wanting the user to type in a number, so that is why the
%:int is after. The :int is used for when the user types in numbers.
put"How old are you?" %pretty simple, just asking the user 'how old are you?'"
get age %Now, this get command will allow the user to type in anything. The
%User can type in words and numbers, but since age is declared as a :int,
%the program will only allow a number if the user hits enter. If the user types
%in a letter then the program will terminate. So smiply, this get command
%allows the user to type. The variable is age, so you want to put get age. if you
%put get ages then it won't work because you created a variable for age
cls%Clears the screen afterwards
%that is a basic variable...if you want the user to t ype in words, then
%instead of :int you would put :string. String allows the user to type in
%words...
%any more questions my email is circa_appleyard707hotmail.com
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
chrispminis
|
Posted: Tue Mar 21, 2006 10:16 pm Post subject: (No subject) |
|
|
This should be in Turing Tutorials section. Not to mention we already have perfectly good variable tutorials in that section. |
|
|
|
|
|
Imm0rtal
|
Posted: Tue Mar 21, 2006 11:53 pm Post subject: (No subject) |
|
|
chrispminis wrote: This should be in Turing Tutorials section. Not to mention we already have perfectly good variable tutorials in that section.
Wtf is a variable? |
|
|
|
|
|
person
|
Posted: Wed Mar 22, 2006 11:52 am Post subject: (No subject) |
|
|
Your kidding right?
In that case, read his tutorial...for example it could be
code: | var variableName : int |
|
|
|
|
|
|
do_pete
|
Posted: Wed Mar 22, 2006 2:40 pm Post subject: (No subject) |
|
|
Imm0rtal wrote: Wtf is a variable?
Check out the Turing Walkthrough |
|
|
|
|
|
Imm0rtal
|
Posted: Wed Mar 22, 2006 5:33 pm Post subject: (No subject) |
|
|
O u meen those words that = other words? I never use those.. they take up too much space. |
|
|
|
|
|
[Gandalf]
|
Posted: Wed Mar 22, 2006 6:29 pm Post subject: (No subject) |
|
|
Please, no more posts here... It's obvious at least one person is being sarcastic here, and this is becoming spam. I'm pretty sure that everyone who posts here knows what variables are. If not from computer science, then at least math. |
|
|
|
|
|
Cervantes
|
Posted: Wed Mar 22, 2006 7:06 pm Post subject: (No subject) |
|
|
Hi upthescale: Glad to see you're submitting. However, Turing tutorials belong in the [Turing Tutorials] forum, not [Turing Help]. Also, we try to have a standard of excellence for our tutorials. This tutorial doesn't quite meet that standard. Also, we've already got a tutorial on the subject (here) that is at that standard. If I do say so myself. ;)
chrispminis wrote: This should be in Turing Tutorials section. Not to mention we already have perfectly good variable tutorials in that section.
Indeed, but let's go with [Off Topic] since this isn't quite a tutorial, and the thread has indeed gone off topic. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|