GDScript for Ruby Developers
Move from Ruby to Godot 4 GDScript: typing, array ownership, callables, script classes, signals and explicit failures. Build a tested stock depot through 48 multi-file console lessons and port two Ruby programs.
Ruby and GDScript side by side
The same program in Ruby and in GDScript, from the lessons of this course.
Text and Comments
Ruby scripts evaluate top-level statements, while this runner constructs a GDScript Node and invokes _ready. Ruby puts prints separate arguments on separate lines; use interpolation when they belong on one line. GDScript print joins arguments without spaces…
Ruby1puts "tag #{7}"; puts "# data"GDScript1extends Node2 3func _ready() -> void:4 print("tag", 7)5 print("# data")Branches and Values
Ruby if/elsif/else forms an expression and uses end; its ternary form is condition ? yes : no. GDScript uses indentation, elif and yes if condition else no. Both choose one branch, but Ruby truthiness does not make zero or empty text false. Order conditions…
Ruby1n=-2; puts(n<0 ? "west" : "east")GDScript1extends Node2 3func _ready() -> void:4 var n: int = -25 print("west" if n < 0 else "east")Array Operations
Ruby Arrays and GDScript Arrays are growable sequences with zero-based indices and negative offsets from the end. Ruby << and GDScript append mutate their containers rather than create independent ownership. Ruby out-of-range [] can return nil, while GDScript…
Ruby1items=[3]; items << 8; removed=items.pop; puts "#{removed} #{items.size}"GDScript1extends Node2 3func _ready() -> void:4 var items: Array = [3]5 items.append(8)6 var removed = items.pop_back()7 print("%d %d" % [removed,items.size()])String Operations
Ruby Strings are mutable unless frozen; gsub returns a replaced string while gsub! mutates its receiver. GDScript String.replace returns a new value. Ruby sub changes only the first match, and gsub accepts either a regular expression or a literal String…
Ruby1s="a-b-a"; t=s.gsub("-","/"); puts "#{s} #{t}"GDScript1extends Node2 3func _ready() -> void:4 var s: String = "a-b-a"5 var t: String = s.replace("-","/")6 print(s," ",t)Scripts as Classes
A Ruby file can define multiple classes and top-level behavior, while a GDScript file defines a script class. class_name registers its global name and new constructs an instance. Ordinary object assignments share references rather than clone objects in both…
Ruby1class Token2 attr_accessor :text3 def initialize; @text="blue"; end4end5a=Token.new; b=a; b.text="gold"; puts a.textGDScript1class_name DemoToken2extends RefCounted3var text: String = "blue"Inheritance and Super
Ruby classes inherit from one superclass and can incorporate modules into method lookup. GDScript scripts extend one base class without Ruby module-inclusion semantics. Both provide super, but Ruby super without parentheses forwards current arguments while…
Ruby1class Base2 def label; "base"; end3end4class Child < Base5 def label; super+"!"; end6end7puts Child.new.labelGDScript1class_name DemoBase2extends RefCounted3func label() -> String:4 return "base"
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsScripts and Scalar Values
6 lessonsFlow and Functions
6 lessonsCollection Ownership
6 lessonsText and Callable Values
3 lessonsObjects and State
5 lessonsObject Relationships
5 lessonsEvents and Failure
5 lessonsBoundaries and Lifetimes
6 lessonsConnected Stock Depot
Project4 lessonsFinal Ports
2 lessonsFrequently asked questions
Who is GDScript for Ruby Developers for?
For people who already write Ruby and want to learn GDScript. Each lesson starts from Ruby you know and shows how GDScript does the same thing, so you skip the beginner basics.
Do I need to know GDScript already?
No. The course starts with your first GDScript program. You need Ruby basics: variables, conditions, loops, functions and collections.
How many lessons does GDScript for Ruby Developers have?
GDScript for Ruby Developers contains 48 interactive lessons you can complete at your own pace.
What does GDScript for Ruby Developers cover?
The course is organized into chapters covering: Scripts and Scalar Values, Flow and Functions, Collection Ownership, Text and Callable Values, and more.
Is GDScript for Ruby Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.