Sign in Join
Wiki copytemporary

In/fi: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-[[Reserved word/fi|Varattu sana]] `in` testaa kuuloko kyseinen arvo [[Set/fi|joukkoon]]. Se palauttaa [[Boolean/fi|boolean]] arvon [ `true`](</index.php?title=True/fi&action=edit&redlink=1> "True/fi \(page does not exist\)") jos arvo kuuluu joukkoon ja arvon [[False|`false`]] jos se ei kuulu kyseiseen joukkoon. `In` sanaa käytetään myös varatun sanan [`for`](</index.php?title=For/fi&action=edit&redlink=1> "For/fi \(page does not exist\)") kanssa [[for-in loop|for-in -silmukassa]].
1+[[Reserved word/fi|Varattu sana]] `in` testaa kuuloko kyseinen arvo [[Set/fi|joukkoon]]. Se palauttaa [[Boolean/fi|boolean]] arvon [[True/fi|true]] jos arvo kuuluu joukkoon ja arvon [[False|false]] jos se ei kuulu kyseiseen joukkoon. `In` sanaa käytetään myös varatun sanan [[For/fi|for]] kanssa [[for-in loop|for-in -silmukassa]].
22
33## Esimerkki ohjelma
4-```
4+
5+``` pascal
56program projectin;
6- uses SysUtils,TypInfo;
7-
8- type
9- marja = (mustikka, lehtokuusama, puolukka, vadelma, lumimarja, mansikka);
10- Berries = set of marja;
11- var
12- kori: Berries;
13- someberry:marja;
14- str:string;
15- i:integer;
16- begin
17- kori := [];
18- writeLn('Valitse jokin marja seuraavista marjoista koriin');
19- repeat
20- i:=1;
21- for someberry in marja do
22- begin
23- Str := GetEnumName(TypeInfo(marja),ord(someberry));
24- writeln(i,' : ',Str);
25- inc(i);
26- end;
27- writeln('0 : poistu ');
28- writeln;
29- readln (i);
30- if i>0 then
31- begin
32- someberry :=marja(i-1);
33- Include(kori,someberry);
34- end;
35- until i=0;
36- if (lehtokuusama in kori) or (lumimarja in kori) then
37- begin
38- writeln ('Sinulla on myrkyllisiä marjoja korissasi');
39- if lehtokuusama in kori then
40- writeln ('Korissasi on myrkyllinen lehtokuusama!') ;
41- if lumimarja in kori then
42- writeln ('Korissasi on myrkyllinen lumimarja!');
43- end;
44- writeln('Joten sinulla oli nämä marjat korissasi:');
45- for someberry in kori do
7+uses SysUtils,TypInfo;
8+
9+type
10+ marja = (mustikka, lehtokuusama, puolukka, vadelma, lumimarja, mansikka);
11+ Berries = set of marja;
12+var
13+ kori: Berries;
14+ someberry:marja;
15+ str:string;
16+ i:integer;
17+begin
18+ kori := [];
19+ writeLn('Valitse jokin marja seuraavista marjoista koriin');
20+ repeat
21+ i:=1;
22+ for someberry in marja do
4623 begin
4724 Str := GetEnumName(TypeInfo(marja),ord(someberry));
48- writeln(Str);
25+ writeln(i,' : ',Str);
26+ inc(i);
4927 end;
50- readln ;
51- end.
28+ writeln('0 : poistu ');
29+ writeln;
30+ readln (i);
31+ if i>0 then
32+ begin
33+ someberry :=marja(i-1);
34+ Include(kori,someberry);
35+ end;
36+ until i=0;
37+ if (lehtokuusama in kori) or (lumimarja in kori) then
38+ begin
39+ writeln ('Sinulla on myrkyllisiä marjoja korissasi');
40+ if lehtokuusama in kori then
41+ writeln ('Korissasi on myrkyllinen lehtokuusama!') ;
42+ if lumimarja in kori then
43+ writeln ('Korissasi on myrkyllinen lumimarja!');
44+ end;
45+ writeln('Joten sinulla oli nämä marjat korissasi:');
46+ for someberry in kori do
47+ begin
48+ Str := GetEnumName(TypeInfo(marja),ord(someberry));
49+ writeln(Str);
50+ end;
51+ readln ;
52+end.
53+
54+
5255```
5356
5457---
55-*From the Free Pascal wiki, page "In/fi", as the Internet Archive kept it on 2025-02-09. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
58+*From the Free Pascal wiki, page "In/fi", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history