Groovy Betikleri ve GShell
Groovy betikleri yazıp çalıştırmayı ve Groovy konsoluyla (GroovyShell) etkileşim kurmayı öğrenin.
Groovy Betikleri ve GShell, CoddyKit'te ücretsiz bir Groovy & Gradle: JVM Automation and Build Engineering dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Groovy & Gradle: JVM Automation and Build Engineering öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Groovy & Gradle: JVM Automation and Build Engineering kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Groovy Scripts: Quick Automation
A Groovy script is just a file of code that runs directly — no main method required. Perfect for automation and quick utilities.
Simple Script Structure
A Groovy script needs no class or method wrapper — the file itself is the entry point. Just write your lines and run them.
println "Hello from a Groovy script!"
def name = "Coddy"
println "My name is $name"Executing Groovy Scripts
Save your code with a .groovy extension, then run it from the terminal with groovy myScript.groovy. That is the whole workflow.
Script Example: Basic Calculation
This script adds two numbers and branches with an if — a quick taste of how natural and readable Groovy scripting feels.
def num1 = 10
def num2 = 5
def sum = num1 + num2
println "The sum of $num1 and $num2 is: $sum"
if (sum > 10) {
println "That's a big sum!"
}Getting User Input
Scripts can talk to the user too. Read a line from the console with System.in.newReader().readLine(), as shown below.
print "What's your name? "
def name = System.in.newReader().readLine()
println "Hello, $name! Welcome to Groovy."Meet the GroovyShell (GShel)
The GroovyShell (groovysh) is an interactive console — run snippets instantly, test ideas, and get feedback without saving a file.
Launching GShell
Type groovysh to launch the interactive shell, or groovyConsole for the GUI version. We will stick with the command-line one here.
Your First GShell Commands
Inside groovysh, type any Groovy and it runs immediately, showing the result after ===>. Type :exit when you are done.
GShell: Beyond Code
GShell has colon commands for managing your session: :help, :history, :clear, and :reset to wipe declared variables.
Instant Code Testing
GShell shines for instant experiments — call a method or transform a list and see the result right away, no file, compile, or run step.
Script vs. GShell
Consider the following Groovy code snippet:
def x = 5
println x * 2Where would you typically execute this snippet if you want to save it for later use and run it repeatedly?
Recap: Scripts & GShell
You learned the two core Groovy tools: scripts for repeatable .groovy files, and the GroovyShell for instant experimentation.
Sıkça Sorulan Sorular
“Groovy Betikleri ve GShell” dersi ücretsiz mi?
Evet — “Groovy Betikleri ve GShell” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Groovy & Gradle: JVM Automation and Build Engineering kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Groovy & Gradle: JVM Automation and Build Engineering kursu toplamda 4 dersten oluşur.
“Groovy Betikleri ve GShell” dersinde ne öğreneceğim?
Groovy betikleri yazıp çalıştırmayı ve Groovy konsoluyla (GroovyShell) etkileşim kurmayı öğrenin. Groovy & Gradle: JVM Automation and Build Engineering ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Groovy & Gradle: JVM Automation and Build Engineering öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Groovy & Gradle: JVM Automation and Build Engineering, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.
“Groovy Betikleri ve GShell” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Groovy & Gradle: JVM Automation and Build Engineering dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Groovy & Gradle: JVM Automation and Build Engineering dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Groovy ve JVM'e Giriş
- Groovy Söz Dizimi ve Temel Türler
- Groovy Betikleri ve GShell
- Groovy Dizeleri ve GString'ler