mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-11 20:02:09 +00:00
Kotlin: use == and != for string equality
This commit is contained in:
parent
dbafe9d300
commit
f9af027c62
@ -4,9 +4,9 @@ class GildedRose(var items: Array<Item>) {
|
||||
|
||||
fun updateQuality() {
|
||||
for (i in items.indices) {
|
||||
if (!items[i].name.equals("Aged Brie") && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].name != "Aged Brie" && items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ class GildedRose(var items: Array<Item>) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
|
||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].name == "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (items[i].sellIn < 11) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
@ -30,15 +30,15 @@ class GildedRose(var items: Array<Item>) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||
items[i].sellIn = items[i].sellIn - 1
|
||||
}
|
||||
|
||||
if (items[i].sellIn < 0) {
|
||||
if (!items[i].name.equals("Aged Brie")) {
|
||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||
if (items[i].name != "Aged Brie") {
|
||||
if (items[i].name != "Backstage passes to a TAFKAL80ETC concert") {
|
||||
if (items[i].quality > 0) {
|
||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||
if (items[i].name != "Sulfuras, Hand of Ragnaros") {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user