Created
April 29, 2020 04:22
-
-
Save drinkmorewaters/22df73406e9eb5c83d73aeaeba7a5331 to your computer and use it in GitHub Desktop.
Create Struct in Crystal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Cars | |
getter price : Int64 | |
getter condition : String | |
def initialize(@type : String, @price : Int64, @condition : String, @location : String, @color : String)end | |
end | |
johns_car = Cars.new "Holden", 10000, "Fair", "New York", "Red" | |
puts "Johns car is in #{johns_car.condition} condition, although, the price is cheap at only #{johns_car.price}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment