From Test-Scratch-Wiki

m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{:Eng:Repeat () (block)/translate}}
 
{{:Eng:Repeat () (block)/translate}}
 
{{block
 
{{block
|name = Repeat ()
+
|name = () Defa Tekrarla
|image = File:2.0 Repeat_().png
+
|sb = () defa tekrarla
|category = [[Eng:Control Blocks|Control]]
+
|category = [[Tur:Kontrol Blokları|Kontrol]]
|type = [[Eng:C Block|C]]
+
|type = [[Tur:C Bloğu|C]]
 
|default = 10
 
|default = 10
 
}}
 
}}
The '''Repeat ()''' [[Eng:Blocks|block]] is a [[Eng:Control Blocks|Control block]] and a [[Eng:C Block|C block]]. Blocks held inside this block will loop a given amount of times, before allowing the [[Eng:script|script]] to continue.
+
'''() Defa Tekrarla''' [[Tur:Bloklar|bloğu]] bir [[Tur:Kontrol Blokları|Kontrol bloğu]] ve bir [[Tur:C Bloğu|C bloğudur]]. [[Tur:Senaryo|senaryo]]nun devam etmesine izin vermeden önce bu bloğun içinde kalan bloklar belirlenmiş bir miktarda tekrarlanır.
  
If a decimal is put in, the number is [[Eng:Round () (block)|round]]ed up.
+
Eğer bir ondalık sayı koyulmuşsa, numara [[Tur:Yuvarla () (blok)|yuvarlanır]].
  
 
This block has a slight delay, so for optimum speed of execution, [[Eng:Single Frame|Single Frame]] block stacks should be used.
 
This block has a slight delay, so for optimum speed of execution, [[Eng:Single Frame|Single Frame]] block stacks should be used.
  
==Example Uses==
+
==Örnek Kullanımları==
  
 
As this block loops pieces of code, it is widely used for saving space and time. Some common uses are:
 
As this block loops pieces of code, it is widely used for saving space and time. Some common uses are:
Line 72: Line 72:
  
 
==See Also==
 
==See Also==
*[[Eng:Forever (block)|Forever]]
+
*[[Tur:Sürekli Tekrarla (blok)|Sürekli Tekrarla]]
*[[Eng:Repeat Until () (block)|Repeat Until ()]]
+
*[[Tur:() Olana Kadar (blok)|() Olana Kadar]]
  
{{Control Blocks}}
+
{{Tur/Kontrol Blokları}}
[[Category:Control Blocks]]
+
[[Category:Tur/Kontrol Blokları]]

Latest revision as of 14:08, 2 October 2020

() Defa Tekrarla
Category Kontrol
Type C

() Defa Tekrarla bloğu bir Kontrol bloğu ve bir C bloğudur. senaryonun devam etmesine izin vermeden önce bu bloğun içinde kalan bloklar belirlenmiş bir miktarda tekrarlanır.

Eğer bir ondalık sayı koyulmuşsa, numara yuvarlanır.

This block has a slight delay, so for optimum speed of execution, Single Frame block stacks should be used.

Örnek Kullanımları

As this block loops pieces of code, it is widely used for saving space and time. Some common uses are:

  • Repeating code

— using the Repeat () block (and the Repeat Until () block) can save a lot of scripting.

repeat (10)
 change [variable v] by (1)
 next costume
 if <touching [Wall v]?> then
  clear
  broadcast [Reload v]
 else
  stamp
 end
  • Animation

— rather than coding each costume change and delay individually, the Repeat () block (with the Next Costume block) can be used. This saves a lot of scripting.

repeat (8)
 wait (0.05) secs
 next costume
  • Continuous checks

— a sprite can continuously move and sense, for example.

repeat (20)
 change y by (3)
 if <touching [edge v]?> then
  change [color v] effect by (75)
  • Putting one repeat () block inside another is called "nesting". The total repetitions will be the two repeat () block inputs' product. In this case, the nested loops draw 10 times 10, or 100 dots.
set pen size to (2)
go to x:(-100) y:(100)
repeat (10)
    repeat (10)
        pen down
        pen up
        change x by (20)
    end
    set x to (-100)
    change y by (-20)
end

Workaround

Main article: List of Block Workarounds

This block can be replicated with the following code:

set [counter v] to (0)
repeat until <(counter) = (number of times)>
 . . .
 change [counter v] by (1)

See Also

Template:Tur/Kontrol Blokları