このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Introducing Variables: Pascalite Programming- plt1cp HOME - - - - - - - - - Other 構成要素 for programmers - - - - - - - - - Pascalite Tutorial (米)棚上げする/(英)提議する of Contents

Pascalite Programming: Introducing Variables

This 見解/翻訳/版 of this tutorial is 罰金 tuned for a Pascalite, or the 解放する/自由な ソフトウェア Pascalite emulation. Please send me an email with "(民事の)告訴s" if something doesn't work!

If you have the open source FPC, aka 解放する/自由な Pascal or Borland's Turbo Pascal (TP hereafter), then there's a separate tutorial for you, covering much of the ground as 現在のd here for the Pascalite (人が)群がる.



許す a nostalgic digression? As I start this tutorial, I must just 支払う/賃金 homage to Per Ranhoff. I can remember 驚くべき/特命の/臨時の 詳細(に述べる) of a day in the late sixties when I was sitting in my first computer lesson. Per started us with the 概念 of variables. The 明確な/細部 machine he was showing us how to use was the same machine that he who would become technical director of "Toy Story" started his programming on not many years later.

So.. 負かす/撃墜する to work.

Inside the computer, at one level, everything is numbers. You don't always have to work at such a low level... we have already made the Pascalite 陳列する,発揮する "Hi" without having to worry about the fact that the code for H is 72 and the code for i is 105, for instance... but it 支払う/賃金s to be aware that there are numbers inside the machine.

Given that there are numbers 伴う/関わるd, it follows that they must 存在する somewhere. Where they are, again, at one level, is the essence of variables.

Suppose you were 令状ing a programme to calculate the 税金 payable on some 処理/取引. You would need to have the 税金 率 利用できる to your program. It could be 蓄える/店d in a variable.

In the に引き続いて example, we're going to look at the 明言する/公表する of the b0 switch at one point in the program. If it is off, いつかs called open, then the computer "sees" an answer we should call "誤った" if it looks at b0. If b0 is on, aka の近くにd, then the computer sees "true". This is why in our earlier programs we could say things like "If b0 then...". We're going to use the if.. then... else 声明 and variables to 蓄える/店 a 1 when the computer sees "true", and 0 when it sees "誤った". We're 蓄える/店ing the 指示,表示する物 of the switch's 明言する/公表する so that at a later point we can see what 明言する/公表する it WAS in 以前.


現実に, I lied. We're not going to look at the b0 switch, the one we used before. We're going to look at the switch next to it, which is called b1. (Computer people often call the first item of a 始める,決める item "無". Not what we're used to in everyday life, but there are advantages. A switch called b0 by any other 指名する...)

Here's the finished program. Type it in, get rid of any error inducing typos, play with it. In a moment I'll take you through the new stuff. Try to guess what the point of the 新規加入s are.

program third;
var ItWas,ItIs: byte;
begin
if b1 then ItWas:=1 else ItWas:=0;
repeat
令状(lcd,255);
if b0 then 令状(lcd,'b0 true'){no ; here}
   else 令状(lcd,'b0 誤った');
if b1 then ItIs:=1 else ItIs:=0;
until not(ItIs=ItWas);
end.


Did you guess what the 新規加入s did?

You can 述べる them on two levels. Such descriptions are called documentation, and you'll need to do it to get very far in programming.

The first level is 使用者 documentation. For our little program, it would be....

This program will 繰り返して put "b0 true" or "bo 誤った" on the LCD, depending on the 明言する/公表する of switch b0.
If the 使用者 changes the 明言する/公表する of switch b1, the program will stop running.

The deeper level is programmer's documentation. For our little program, it could be....

When the program begins, the 明言する/公表する of switch b1 is checked, and a 無 or a one is 蓄える/店d in the variable ItWas. The program then enters a 宙返り飛行, 陳列する,発揮するing "b0 誤った" or "b0 true". On each pass through the 宙返り飛行, switch b1 is checked again, and a 無 or one is 蓄える/店d in the variable ItIs. Just before program 死刑執行 goes 支援する to the start of the 宙返り飛行, the values 蓄える/店d in ItWas and ItIs are compared. If they are not equal, the program doesn't 宙返り飛行, it goes on past the "until" 声明. As there's nothing more to do, the program stops.

(Yes.. there was a 計画/陰謀 which would have been いっそう少なく programming 成果/努力, but it would have meant putting the "do 宙返り飛行ing" switch 支援する to "yes" every time you switched it to "don't" to 出口 the program.)

Notice: The second line of the program is new. "Var" is a word built into Pascal. It says we're going to "宣言する" some variables. We can't use them unless we've 宣言するd them. Happily, 宣言するing them is no big 取引,協定. The variables we want are entered after var. There are all sorts of 支配するs about what 指名するs are 許すd. For now:
a) Don't try to use a word that is a built in word of Pascal, e.g. var, begin, then, etc.
b) Start the 指名する with a letter.
c) Make the 残り/休憩(する) of the 指名する out of letters or digits only. Don't use punctuation 示すs, nor spaces.

"ItWas" and "ItIs" are both variables, both 指名するs made up by me for this program

After the last variable in the 名簿(に載せる)/表(にあげる) you are 宣言するing, you need a 結腸, then a word to say what TYPE of variable they are to be (more on this in a moment) ("byte" is a built in word of Pascal for one of the 許すd data types) and finally, as (almost) ever, the line ends with a semicolon.

公式文書,認める that the variable 宣言 goes after the "program..." line, but before the program's main "begin".

Once we have 宣言するd the variables, we can use them. Never assume you know what is in a variable that you have not first put something in. This "putting in" is called 割り当てるing a value. To put a 1 in the variable ItWas, the 訂正する 命令(する) is:
ItWas:=1


Think of the :=, which you type by 圧力(をかける)ing first the 結腸 and then the equals 調印する as a 選び出す/独身 (独立の)存在. When you 令状 (by 手渡す) a 資本/首都 X by making two lines, you don't 混乱させる it for "two things" do you? Likewise, think of := as the assignment 操作者. It 支払う/賃金s to read the example above as "ItWas BECOMES 1". In other words, the variable ItWas will, until その上の notice, 含む/封じ込める a 1.

Don't let the use of the equals 調印する in typing the assignment 操作者 混乱させる you. When we say ItWas:=1 we're 原因(となる)ing something to happen.... 1 is 蓄える/店d in ItWas. The equals 調印する (without the 結腸) IS USED in Pascal, and it is used 論理(学)上: It is used for comparing things. We saw this in our first program which had the line "Until 4=5". We were comparing 4 and five, asking if they were equal. 明確に, they are not equal, so "4=5" boiled 負かす/撃墜する to, was 同等(の) to something not true. That's why we repeated the 宙返り飛行 endlessly. We were supposed to REPEAT.... UNTIL (something) was true. Until now, the "something" was "4=5", which will never be true.

In our 最新の program we have "until not(ItIs=ItWas)" look at that in 層s, from inside to outside.....

"ItIs=ItWas" asks "Is what is in the variable called ItIs the same as what is in the variable called ItWas?" If what's going on is not すぐに obvious, look closely at the program and notice where we put things into those two variables. ItIs will 持つ/拘留する the same number as ItWas... at first. So (the contents of) ItIs will equal (the contents of) ItWas. (Usually we 削減(する) that 負かす/撃墜する and just say "ItIs equals ItWas". The "the contents of" part is understood.) Now... if ItIs equals ItWas, then ItIs=ItWas boils 負かす/撃墜する to "true".

Now look at the next 層 outwards, that word "not". It is built into Pascal. If you say "not(something that's true)", it's 同等(の) to 説 "誤った". On the other 手渡す, if you say "not(something that's 誤った)", it's 同等(の) to 説 "true".

More explaining by me at this point may just give you a 頭痛. Before reading on, have a hard look at the program. Try to make sense of what's going on for yourself.

Still not (疑いを)晴らす? The thing that you should get straight is why the program stops 宙返り飛行ing when you change the 明言する/公表する of the b1 switch.

Before you change it, the program obeys the "until...", and 宙返り飛行s 支援する because ItIs and ItWas both 持つ/拘留する the same number, and so ItIs=ItWas is true, but the 全体にわたる 条件 that the until is looking at is "NOT(ItIs=ItWas)". When the number in ItIs changes, ItIs no longer equals ItWas, so ItIs=ItWas boils 負かす/撃墜する to "誤った", and "not(誤った)" is true, so "until" sees "true", so Pascal STOPS 宙返り飛行ing 支援する to the "repeat".

Simple ideas... really... just not simple to explain, and it is 平易な to get something 支援する to 前線. You'll be doing lots with 条件s as you go その上の into programming. You'll get it!

Most Pascals have a way of 実験(する)ing for "not equal", for numbers or for Boolean values. You could, usually, say something like
until (ItIs<>ItWas);
... but Pascalite has nothing like "<>" to stand for "not equal." Tedious, but not hard to work around. To recap: In place of A<>B you 単に 令状 not(A=B).

Good place to take a break. Come 支援する to the 索引 of Pascal tutorials for another one soon!


Please also 公式文書,認める that I have two other 場所/位置s, and that the に引き続いて search will not 含む them. They have their own search buttons.

My Sheepdog Guides 場所/位置.
My Arunet 場所/位置.

Go to the 場所/位置s above, and use their search buttons if you want to search them.
To search this 場所/位置....

Search this 場所/位置 or the web 力/強力にするd by FreeFind

場所/位置 search Web search
The search engine 単に looks for the words you type, so....
*    (一定の)期間 them 適切に.
*    Don't bother with "How do I get rich?" That will 単に return pages with "how", "do", "I"....

You can also search this 場所/位置 without using forms.
広告 from page's editor: Yes.. I do enjoy 収集するing these things for you... hope they are helpful. However.. this doesn't 支払う/賃金 my 法案s!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!
Click here to visit editor's freeware, shareware page.


Want a 場所/位置 hosted, or email? You can also help me if you 調印する up 経由で this link to 1&1's services. (I wouldn't recommend them unless I was happy after several years as one of their 顧客s. The Google advertisers 支払う/賃金 me. I know nothing about them or their services, of course.)



Valid HTML 4.01 Transitional Page has been 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org. Mostly passes.

AND passes... Valid CSS!


Why does this page 原因(となる) a script to run? Because of the Google パネル盤s, and the code for the search button. Also, I have some of my pages' traffic 監視するd for me by eXTReMe tracker. They 申し込む/申し出 a 解放する/自由な tracker. If you want to try one, check out their 場所/位置. Why do I について言及する the script? Be sure you know all you need to about spyware.
Editor's Main Homepage
How to email or 令状 this page's editor, Tom Boyd

....... P a g e . . . E n d s .....